You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would I go about properly running ensure_future only once on a function/coroutine in a starlette + uvicorn combo that uses --workers in uvicorn
Currently I am using the starlette startup event to execute asyncio.ensure_future() on a function that loops grabbing exchange rates from a HTTP API, and if --workers is 8, then i believe it creates 8 of these loops which isnt ideal
How would I go about sharing this loops data with all of them/only executing it once between them all
Is there not an easy solution to this problem?
I suppose I could create a new process specifically for this data that updates it in mongodb and have them all grab it from there, but kind of a lame solution.
Thanks for any time spent reading or replying to my problem!
Important
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
How would I go about properly running ensure_future only once on a function/coroutine in a starlette + uvicorn combo that uses --workers in uvicorn
Currently I am using the starlette startup event to execute asyncio.ensure_future() on a function that loops grabbing exchange rates from a HTTP API, and if --workers is 8, then i believe it creates 8 of these loops which isnt ideal
How would I go about sharing this loops data with all of them/only executing it once between them all
Is there not an easy solution to this problem?
I suppose I could create a new process specifically for this data that updates it in mongodb and have them all grab it from there, but kind of a lame solution.
Thanks for any time spent reading or replying to my problem!
Important
The text was updated successfully, but these errors were encountered: