Skip to content

clifecycle: add SetStopTimeout to make the shutdown grace period configurable - #11

Open
ironAtom wants to merge 1 commit into
gocopper:mainfrom
ironAtom:clifecycle-stop-timeout
Open

clifecycle: add SetStopTimeout to make the shutdown grace period configurable#11
ironAtom wants to merge 1 commit into
gocopper:mainfrom
ironAtom:clifecycle-stop-timeout

Conversation

@ironAtom

Copy link
Copy Markdown

Summary

Lifecycle.Stop waits defaultStopTimeout (a hardcoded 30s) for background goroutines before running cleanup funcs and canceling the lifecycle context. Apps whose background work is bounded by a deadline of similar length (e.g. a job runner whose per-job timeout is also 30s) have zero margin: work claimed just before shutdown can be force-quit right as it is about to finish.

This adds Lifecycle.SetStopTimeout(d time.Duration) so apps can raise the grace period above their own work deadline. Default behavior is unchanged.

Test plan

  • go build ./clifecycle/... and go vet ./clifecycle/... pass
  • No behavior change unless the setter is called

Made with Cursor

…igurable

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant