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

Graceful restart or stop #283

Open
mattmurphy-github opened this issue Jul 16, 2024 · 0 comments
Open

Graceful restart or stop #283

mattmurphy-github opened this issue Jul 16, 2024 · 0 comments

Comments

@mattmurphy-github
Copy link

I would recommend checking for context.DeadlineExceeded instead of "catching" <-ctx.Done() in a select.

For example;

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
err := srv.Shutdown(ctx)
if errors.Is(err, context.DeadlineExceeded) {
log.Println("Timeout of 5 seconds.")
}

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

No branches or pull requests

1 participant