-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Call Application.startup
in GunicornWebWorker
#1105
Call Application.startup
in GunicornWebWorker
#1105
Conversation
Please upgrade to master. appveyor blames:
But the master has no |
It did at #1103 as well. The branch is rebased and is up to date. |
4d14d10
to
bf708c6
Compare
Current coverage is 98.06% (diff: 100%)@@ master #1105 diff @@
==========================================
Files 28 28
Lines 6364 6365 +1
Methods 0 0
Messages 0 0
Branches 1070 1070
==========================================
+ Hits 6241 6242 +1
Misses 64 64
Partials 59 59
|
bf708c6
to
545a494
Compare
@@ -34,7 +34,9 @@ def run(self): | |||
self._runner = ensure_future(self._run(), loop=self.loop) | |||
|
|||
try: | |||
self.loop.run_until_complete(self._runner) | |||
self.loop.run_until_complete(asyncio.gather(self._runner, |
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 suspect parallel execution by gather
is not desired.
At least it works different that web.run_app()
.
Better to wait for self.wsgi.startup()
and than execute self._runner
for opening server-side socket etc.
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'm not sure I get you right. Do you mean to just schedule self.wsgi.startup()
with ensure_future()
and keep the rest as it was done before?
ensure_future(self.wsgi.startup(), loop=self.loop)
self._runner = ensure_future(self._run(), loop=self.loop)
try:
self.loop.run_until_complete(self._runner)
finally:
self.loop.close()
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.
Fixed as you suggested.
- Similar call as done before for `web.run_app` - Extended test case to check `worker.wsgi.startup` has been called once.
Every future worth to be awaited :)
Initialize app on first step and run it on the second. |
Ah, I already thought to |
545a494
to
d90bbbe
Compare
Thanks! |
What do these changes do?
web.run_app()
to callApplication.startup()
along with the request handler.worker.wsgi.startup
has been called once.Are there changes in behavior for the user?
None
Related issue number
#1092
Checklist