mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vmctl: fix progress bar not being stopped on error during import process (#3023)
vmctl: fix progress bar not being stopped on error during import process
This commit is contained in:
parent
f49c9bb700
commit
30fb4b948e
4 changed files with 8 additions and 3 deletions
|
@ -52,6 +52,7 @@ func (ip *influxProcessor) run(silent, verbose bool) error {
|
|||
if err := barpool.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
defer barpool.Stop()
|
||||
|
||||
seriesCh := make(chan *influx.Series)
|
||||
errCh := make(chan error)
|
||||
|
@ -96,7 +97,7 @@ func (ip *influxProcessor) run(silent, verbose bool) error {
|
|||
for err := range errCh {
|
||||
return fmt.Errorf("import process failed: %s", err)
|
||||
}
|
||||
barpool.Stop()
|
||||
|
||||
log.Println("Import finished!")
|
||||
log.Print(ip.im.Stats())
|
||||
return nil
|
||||
|
|
|
@ -82,6 +82,9 @@ func (op *otsdbProcessor) run(silent, verbose bool) error {
|
|||
errCh := make(chan error)
|
||||
// we're going to make serieslist * queryRanges queries, so we should represent that in the progress bar
|
||||
bar := pb.StartNew(len(serieslist) * queryRanges)
|
||||
defer func(bar *pb.ProgressBar) {
|
||||
bar.Finish()
|
||||
}(bar)
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(op.otsdbcc)
|
||||
for i := 0; i < op.otsdbcc; i++ {
|
||||
|
|
|
@ -43,6 +43,7 @@ func (pp *prometheusProcessor) run(silent, verbose bool) error {
|
|||
if err := barpool.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
defer barpool.Stop()
|
||||
|
||||
blockReadersCh := make(chan tsdb.BlockReader)
|
||||
errCh := make(chan error, pp.cc)
|
||||
|
@ -89,7 +90,7 @@ func (pp *prometheusProcessor) run(silent, verbose bool) error {
|
|||
for err := range errCh {
|
||||
return fmt.Errorf("import process failed: %s", err)
|
||||
}
|
||||
barpool.Stop()
|
||||
|
||||
log.Println("Import finished!")
|
||||
log.Print(pp.im.Stats())
|
||||
return nil
|
||||
|
|
|
@ -89,6 +89,7 @@ func (p *vmNativeProcessor) run(ctx context.Context) error {
|
|||
log.Printf("error start process bars pool: %s", err)
|
||||
return err
|
||||
}
|
||||
defer barpool.Stop()
|
||||
|
||||
w := io.Writer(pw)
|
||||
if p.rateLimit > 0 {
|
||||
|
@ -106,7 +107,6 @@ func (p *vmNativeProcessor) run(ctx context.Context) error {
|
|||
}
|
||||
<-sync
|
||||
|
||||
barpool.Stop()
|
||||
log.Println("Import finished!")
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue