-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Listeners for main server process #2018
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2018 +/- ##
=============================================
+ Coverage 91.719% 91.754% +0.036%
=============================================
Files 35 35
Lines 3200 3226 +26
Branches 555 557 +2
=============================================
+ Hits 2935 2960 +25
Misses 181 181
- Partials 84 85 +1
Continue to review full report at Codecov.
|
…nto main-process-listeners
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.
Approved.
@@ -920,6 +921,13 @@ async def create_server( | |||
server_settings.get("before_start", []), | |||
server_settings.get("loop"), | |||
) | |||
main_start = server_settings.pop("main_start", None) | |||
main_stop = server_settings.pop("main_stop", None) | |||
if main_start or main_stop: |
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.
I appreciate this given the number of create_server issues that come up.
Stems from discussion in #2015.
This is a POC for adding listeners that only are triggered in the main server process. There is no testing yet, and I have not done any edge cases (ASGI should throw error).
Eventually, this should be replaced by #1630.
Single server
Multiple servers