Skip to content

Conversation

@maxdml
Copy link
Collaborator

@maxdml maxdml commented Aug 20, 2025

  • Stop workflows scheduler on /deactivate requests
  • Add timeouts to Shutdown

@maxdml maxdml changed the title Shutdown/Cancel interface Shutdown/Cancel interface: "Deactivate" Aug 20, 2025
Comment on lines +559 to +571
done := make(chan struct{})
go func() {
as.wg.Wait()
close(done)
}()

select {
case <-done:
as.logger.Info("Admin server shutdown complete")
case <-ctx.Done():
as.logger.Warn("Admin server shutdown timed out")
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It turns out that Shutdown on http.Server is non blocking and graceful, i.e., it doesn't terminate existing connections. Waiting on the goroutine that started it to be done is a clean(er) way to wait for the server's full termination.

Comment on lines +406 to +409
c.logger.Info("Queue runner completed")
c.queueRunner = nil
case <-time.After(timeout):
c.logger.Warn("Timeout waiting for queue runner to complete", "timeout", timeout)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we cannot safely set the pointer to nil in case of timeout: the resource might yet to be accessed, which would cause a panic.

@maxdml maxdml marked this pull request as ready for review August 20, 2025 22:51
@maxdml maxdml changed the title Shutdown/Cancel interface: "Deactivate" Shutdown/Cancel interface, "Deactivate" Aug 21, 2025
@maxdml maxdml merged commit b61d9c5 into main Aug 21, 2025
2 checks passed
@maxdml maxdml deleted the shutdown-cancel-ux branch August 21, 2025 21:04
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