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

Put a timeout for timer task deletion loop during shutdown #5626

Conversation

taylanisikdemir
Copy link
Member

What changed?
Timer queue processor has a loop to delete tasks batch by batch periodically and also during shut down. It just uses background context so it can take a long time in theory.
For shut down scenario adding a timeout to make sure it doesn't hang the process when there's a lot of tasks to delete.

Why?
Respect shut down signals to make rollouts/restarts more smooth.

How did you test it?
Will test in a staging environment. Changes are behind a dynamic config.

@@ -365,7 +375,7 @@ func (t *timerQueueProcessor) completeTimerLoop() {
return
case <-completeTimer.C:
for attempt := 0; attempt < t.config.TimerProcessorCompleteTimerFailureRetryCount(); attempt++ {
err := t.completeTimer()
err := t.completeTimer(context.Background())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be unbounded, this is strictly better however.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I debated on this but leaving it as is for now to limit the changes to be tested in actual deployment

@coveralls
Copy link

coveralls commented Jan 24, 2024

Pull Request Test Coverage Report for Build 018d3d8b-6e10-4d6d-88cf-9cc97fe07601

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 62.66%

Totals Coverage Status
Change from base Build 018d3d7e-26f1-4781-8625-99e1d43f6b3d: -0.02%
Covered Lines: 92106
Relevant Lines: 146994

💛 - Coveralls

@taylanisikdemir taylanisikdemir force-pushed the taylan/timer_task_deletion_timeout branch from 245f38b to bec3a33 Compare January 24, 2024 22:16
@taylanisikdemir taylanisikdemir merged commit 8a42ce8 into cadence-workflow:master Jan 24, 2024
16 checks passed
@taylanisikdemir taylanisikdemir deleted the taylan/timer_task_deletion_timeout branch January 24, 2024 22:37
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.

3 participants