From ade4a0ef7fefeac09759019db9c7df8890d6e849 Mon Sep 17 00:00:00 2001 From: Rogee Date: Thu, 5 Sep 2024 15:56:27 +0800 Subject: [PATCH] fix: sleep issues --- internal/cmd_channel_export.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/cmd_channel_export.go b/internal/cmd_channel_export.go index a0ac319..7a9a96c 100644 --- a/internal/cmd_channel_export.go +++ b/internal/cmd_channel_export.go @@ -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 }