fiber
fiber copied to clipboard
🚀 [Feature]: Shutdown() add optional timeout
Feature Description
Currently when I call Shutdown(), it seems to wait a long time (many minutes).
It would be good for it to pass in an optional ctx or a max wait time. If it hasn't gracefully shutdown by the max wait time, it hard kills the server connections etc.
Additional Context (optional)
No response
Code Snippet (optional)
No response
Checklist:
- [X] I agree to follow Fiber's Code of Conduct.
- [X] I have checked for existing issues that describe my suggestion prior to opening this one.
- [X] I understand that improperly formatted feature requests may be closed without explanation.
As different as Shutdown(), we can add ShutdownWithContext(ctx) that checks ctx before graceful shutdowning
@li-jin-gou https://github.com/valyala/fasthttp/issues/1389#issuecomment-1267351046
You can access fasthttp.Server with https://github.com/gofiber/fiber/blob/master/app.go#L852. But it's also OK to me add Close() method to Fiber.