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
As explained in this stack overflow post , we are running a Django server on gunicorn with gevent workers. The entire website is running in sync mode but we made the mistake (?) of rewriting part of our view code using asyncio.
asyncdefutility_func(urls):
# these use httpx async httpx request awaitasyncio.gather(download_from_urls)
classMyView(generic.edit.FormView)
defform_valid(self, form):
asyncio.run(utility_func(form.cleaned_data['urls']))
The view function is 10 times faster, but other parts of the website throws SynchronousOnlyOperation exceptions when the asyncio code is running, likely because they are executed in the async context created by asyncio.run. Can anyone explain to me what is happening here and how I should resolve the issue?
The text was updated successfully, but these errors were encountered:
As explained in this stack overflow post , we are running a Django server on gunicorn with gevent workers. The entire website is running in sync mode but we made the mistake (?) of rewriting part of our view code using asyncio.
The view function is 10 times faster, but other parts of the website throws
SynchronousOnlyOperation
exceptions when the asyncio code is running, likely because they are executed in the async context created byasyncio.run
. Can anyone explain to me what is happening here and how I should resolve the issue?The text was updated successfully, but these errors were encountered: