fix: sleep issues
This commit is contained in:
@@ -3,7 +3,6 @@ package internal
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"exporter/config"
|
||||
@@ -52,13 +51,12 @@ func channelExportCmd(ctx context.Context) error {
|
||||
if err := client.Channel(ctx, channel, cfg, false); err != nil {
|
||||
logger.Error("failed to export channel", zap.Error(err), zap.Int64("uuid", channel.GetID()))
|
||||
continueRetryTimes++
|
||||
sleepSeconds := math.Pow(2, float64(1+continueRetryTimes))
|
||||
if sleepSeconds > 128 {
|
||||
if continueRetryTimes > 6 {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info("retry after", zap.Int("seconds", int(sleepSeconds)))
|
||||
time.Sleep(time.Second * time.Duration(sleepSeconds))
|
||||
logger.Info("retry after 1 min")
|
||||
time.Sleep(time.Minute)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user