Closed bartonology closed 2 years ago
Are you sure this is caused by asyncio-timeout? I've experimented some issues with aiohttp because it create a new loop in recent version. So if your web app use a loop which is not the one initiatialized while setting the cron, it won't work.
As I remember you can pass a loop to web.run_app. Give it a try.
Another solution is to initialize your cron when the webapp start. There's some hook for that.
If none of those works then you found a bug
No, I'm not sure of anything at the moment. Libraries updated on me and after debugging why I couldn't get any cron methods to fire, I found I can lightswitch the issue by rolling between 3.0.1 and 4.0.1 with async-timeout.
Thanks for the ideas. I'll give the loop tests a try. AFAIK, I'm not switching any loops around. If aiohttp or something else is, then I would think it would at least need to be documented.
That was exactly the issue. aiohttp had changed from using asyncio.get_event_loop()
to asyncio.new_event_loop()
when no loop was passed in. There's several ways to get this to work, but I opted for passing the asyncio.get_event_loop()
into run_app(...)
like how it used to work just like @gawel suggested.
Thanks. Closing.
With this code:
This Works
and using async-timeout == 3.0.1, I get this output (using poetry):
Here's the working poetry deps:
The Issue
when I switch to the latest (4.0.1), the callit() method never gets called. Here's the poetry deps:
... and the output is missing the log I expect.
This sure looks like library breakage. Thoughts?