Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't call ticker.Reset #1162

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,7 @@ func (a *FlowableActivity) SendWALHeartbeat(ctx context.Context) error {
return nil
}

sendTimeout := 10 * time.Minute
ticker := time.NewTicker(sendTimeout)
ticker := time.NewTicker(10 * time.Minute)
defer ticker.Stop()

activity.RecordHeartbeat(ctx, "sending walheartbeat every 10 minutes")
Expand Down Expand Up @@ -768,7 +767,6 @@ func (a *FlowableActivity) SendWALHeartbeat(ctx context.Context) error {
slog.InfoContext(ctx, fmt.Sprintf("sent walheartbeat to peer %v", pgPeer.Name))
}
}
ticker.Reset(sendTimeout)
}
}

Expand Down
4 changes: 1 addition & 3 deletions flow/activities/slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ func (a *FlowableActivity) recordSlotSizePeriodically(
return
}

timeout := 5 * time.Minute
ticker := time.NewTicker(timeout)
ticker := time.NewTicker(5 * time.Minute)
defer ticker.Stop()

for {
Expand All @@ -89,6 +88,5 @@ func (a *FlowableActivity) recordSlotSizePeriodically(
case <-ctx.Done():
return
}
ticker.Reset(timeout)
}
}
6 changes: 1 addition & 5 deletions flow/connectors/eventhub/eventhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ func (c *EventHubConnector) processBatch(
batchPerTopic := NewHubBatches(c.hubManager)
toJSONOpts := model.NewToJSONOptions(c.config.UnnestColumns, false)

eventHubFlushTimeout := peerdbenv.PeerDBEventhubFlushTimeoutSeconds()

ticker := time.NewTicker(eventHubFlushTimeout)
ticker := time.NewTicker(peerdbenv.PeerDBEventhubFlushTimeoutSeconds())
defer ticker.Stop()

lastSeenLSN := int64(0)
Expand Down Expand Up @@ -219,8 +217,6 @@ func (c *EventHubConnector) processBatch(
return 0, fmt.Errorf("failed to update last offset: %w", err)
}
}

ticker.Reset(eventHubFlushTimeout)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion flow/connectors/utils/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func HeartbeatRoutine(
case <-ctx.Done():
return
case <-ticker.C:
ticker.Reset(15 * time.Second)
}
}
}()
Expand Down
Loading