From ca68b64e781bdfec11ea59c255b06f4b18f0db22 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 25 Jan 2024 08:07:31 -0500 Subject: [PATCH] Revert "tickers: use Reset over Stop/NewTicker (#985)" This reverts commit 5b0c8b3b712ef8f561afb470acddab24769f8598. --- flow/activities/flowable.go | 3 ++- flow/activities/slot.go | 3 ++- flow/connectors/eventhub/eventhub.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/flow/activities/flowable.go b/flow/activities/flowable.go index 1414cdeff1..7c1b7e4656 100644 --- a/flow/activities/flowable.go +++ b/flow/activities/flowable.go @@ -784,7 +784,8 @@ func (a *FlowableActivity) SendWALHeartbeat(ctx context.Context) error { slog.InfoContext(ctx, fmt.Sprintf("sent walheartbeat to peer %v", pgPeer.Name)) } } - ticker.Reset(sendTimeout) + ticker.Stop() + ticker = time.NewTicker(sendTimeout) } } diff --git a/flow/activities/slot.go b/flow/activities/slot.go index 8e8bb9aea0..4a846e77c7 100644 --- a/flow/activities/slot.go +++ b/flow/activities/slot.go @@ -89,6 +89,7 @@ func (a *FlowableActivity) recordSlotSizePeriodically( case <-ctx.Done(): return } - ticker.Reset(timeout) + ticker.Stop() + ticker = time.NewTicker(timeout) } } diff --git a/flow/connectors/eventhub/eventhub.go b/flow/connectors/eventhub/eventhub.go index a7e3c330a5..0948eef6ac 100644 --- a/flow/connectors/eventhub/eventhub.go +++ b/flow/connectors/eventhub/eventhub.go @@ -224,7 +224,8 @@ func (c *EventHubConnector) processBatch( } } - ticker.Reset(eventHubFlushTimeout) + ticker.Stop() + ticker = time.NewTicker(eventHubFlushTimeout) } } }