From f379bb8c10d7698660bbca4fe0e35ab5a2a7c528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Thu, 4 Jan 2024 15:37:34 +0000 Subject: [PATCH] tickers: use Reset over Stop/NewTicker --- flow/activities/flowable.go | 3 +-- flow/activities/slot.go | 3 +-- flow/connectors/eventhub/eventhub.go | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/flow/activities/flowable.go b/flow/activities/flowable.go index a2e57f6d0f..6ee858c028 100644 --- a/flow/activities/flowable.go +++ b/flow/activities/flowable.go @@ -819,8 +819,7 @@ func (a *FlowableActivity) SendWALHeartbeat(ctx context.Context) error { slog.InfoContext(ctx, fmt.Sprintf("sent walheartbeat to peer %v", pgPeer.Name)) } } - ticker.Stop() - ticker = time.NewTicker(sendTimeout) + ticker.Reset(sendTimeout) } } diff --git a/flow/activities/slot.go b/flow/activities/slot.go index baa0fbc0fa..ef0114102a 100644 --- a/flow/activities/slot.go +++ b/flow/activities/slot.go @@ -88,7 +88,6 @@ func (a *FlowableActivity) recordSlotSizePeriodically( case <-ctx.Done(): return } - ticker.Stop() - ticker = time.NewTicker(timeout) + ticker.Reset(timeout) } } diff --git a/flow/connectors/eventhub/eventhub.go b/flow/connectors/eventhub/eventhub.go index c8ba3dad41..1bb7b00166 100644 --- a/flow/connectors/eventhub/eventhub.go +++ b/flow/connectors/eventhub/eventhub.go @@ -195,8 +195,7 @@ func (c *EventHubConnector) processBatch( } } - ticker.Stop() - ticker = time.NewTicker(eventHubFlushTimeout) + ticker.Reset(eventHubFlushTimeout) } } }