-
Notifications
You must be signed in to change notification settings - Fork 86
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
feat: add Shutdown to support graceful quit of HTTP Server #618
Conversation
Important Review skippedAuto reviews are limited to specific labels. Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the previous PR, I said we need to change Singleton
to Bind
. I reviewed it, and it's wrong (sorry for this). The Route facade should be a singleton instance, because Routers are registered to the Route facade. If so, in order to adapt the situation of calling Run
and RunTLS
simultaneously, the server
may need to change to []*http.Server
from *http.Server
in this PR: https://github.com/goravel/gin/pull/83/files , close all servers at the same time when calling the Shutdown
method. Any thoughts, please?
I still think it is not suitable to use slice to manage server instances. In practice, there are usually no multiple instances at the same time. Mounting multiple http servers on the struct is also more convenient to manage than slice. More situations that need to consider multiple server instances are: different host, port and routes. In this case, maybe need to open a separate facade to create a new route instance. The default facade.Route() is associated with too many things. |
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## v1.14.x #618 +/- ##
==========================================
Coverage ? 70.35%
==========================================
Files ? 176
Lines ? 10978
Branches ? 0
==========================================
Hits ? 7724
Misses ? 2686
Partials ? 568 β View full report in Codecov by Sentry. |
Emm, another facade is unexpected. And yes, there are usually no multiple instances at the same time. Maybe we can add a new method: |
@hwbrzzl has compatibled goravel/gin#83 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR π
π Description
Closes https://github.com/goravel/goravel/issues/436
@coderabbitai summary
β Checks