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
aiohttp/worker.py
Outdated
|
|
||
| try: | ||
| self.loop.run_until_complete(self._runner) | ||
| self.loop.run_until_complete(asyncio.gather(self._runner, |
There was a problem hiding this comment.
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.
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.
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.startuphas been called once.Are there changes in behavior for the user?
None
Related issue number
#1092
Checklist