-
-
Notifications
You must be signed in to change notification settings - Fork 120
Add Service Lifecycle Support #646
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #646 +/- ##
==========================================
- Coverage 24.36% 24.35% -0.01%
==========================================
Files 148 148
Lines 8673 8676 +3
==========================================
Hits 2113 2113
- Misses 6560 6563 +3
🚀 New features to boost your workflow:
|
| try await gracefulShutdown() | ||
| await self.shutdownAsync() |
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.
| try await gracefulShutdown() | |
| await self.shutdownAsync() | |
| do { | |
| try await gracefulShutdown() | |
| } catch is CancellationError { | |
| // ignore; we still need to shut down for sudden cancellation | |
| } | |
| await self.shutdownAsync() |
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.
We probably want to trigger a shutdown for any error actually right? So a try? might be better.
These changes are now available in 1.53.0
Adds support for Swift Service Lifecycle as we prepare Vapor for Vapor 5.
This allows you to add
Databasesto aServiceGroupand have service lifecycle handle shutting down the connection pool when the application exits and provides a better integration with the ecosystem.