Skip to content

Conversation

@majiayu000
Copy link

Fixes #18175

Changes

  • Add check in AlignedTicker.next() to ensure duration is positive after applying negative offset
  • Update sleep() to handle negative durations by returning immediately
  • Add tests for negative offset behavior

When using a negative collection_offset value, the AlignedTicker could
calculate a duration less than or equal to zero, causing the timer to
fire immediately and repeatedly. This resulted in multiple executions
and "Previous collection has not completed" debug messages.

The fix ensures that when the calculated duration (time to next aligned
interval plus offset) is non-positive, one full interval is added to
schedule for the next valid tick time. This check is performed before
adding jitter to maintain proper timing behavior.

Also updated the sleep function to handle negative durations by
returning immediately instead of creating a timer with a negative value.

Fixes influxdata#18175

Signed-off-by: majiayu000 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Negative collection_offset Causes Multiple Executions

1 participant