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

Add TermHandler #30

Merged
merged 5 commits into from
Jun 20, 2024
Merged

Add TermHandler #30

merged 5 commits into from
Jun 20, 2024

Conversation

fujiwara
Copy link
Owner

SIGTERM handler

ridge catches SIGTERM and stops the server gracefully by default.

You can add a custom handler to the SIGTERM signal.

r := ridge.New(":8080", "/", mux)
r.SIGTERMHandler = func() {
	// your custom handler
}
r.RunWithContext(ctx)

ridge calls the handler when it receives a SIGTERM signal. After the handler returns, ridge stops the server.

When you run ridge on AWS Lambda, ridge uses lambda.WithEnableSIGTERM to call the handler. In this case, the handler must return in 500ms.

@fujiwara fujiwara merged commit ddea9f6 into main Jun 20, 2024
2 checks passed
@fujiwara fujiwara deleted the term branch June 20, 2024 02:11
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