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