From 0c7ec75dd699a3eae7d8775eb3d37eb7991ae0b6 Mon Sep 17 00:00:00 2001 From: System Administrator Date: Tue, 20 Dec 2022 20:52:40 +0800 Subject: [PATCH] fix:correct 'RunTicker' method --- dth/job.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/dth/job.go b/dth/job.go index f4f05b9..568e69d 100644 --- a/dth/job.go +++ b/dth/job.go @@ -137,15 +137,10 @@ func RunTicker(ctx context.Context, cfg *JobConfig) { t := &JobTicker{} t.updateTimer() for { - select { - case <-ctx.Done(): - log.Printf("timer has been stopped") - t.timer.Stop() - case <-t.timer.C: - log.Printf("ticker update S3 Credentials") - updateCreds(ctx, cfg) - t.updateTimer() - } + <-t.timer.C + log.Printf("ticker update S3 Credentials") + updateCreds(ctx, cfg) + t.updateTimer() } }