Make sure message is emitted? #1731
-
Hello! I have an app that sends a message through emit(), then do some calculation that takes some time, then emit() another message. The issue is that when using uwsgi, both emit() are received by the client after the calculation is performed. I suppose that is because the server is busy working on the calculation, and is preventing the async function to trigger. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You cannot have code that blocks for a long time, that is incompatible with the async mode that you are using (which I assume is the If your long calculation is done inside of a loop, add |
Beta Was this translation helpful? Give feedback.
You cannot have code that blocks for a long time, that is incompatible with the async mode that you are using (which I assume is the
gevent_uwsgi
mode).If your long calculation is done inside of a loop, add
socketio.sleep(0)
inside the loop and that might help.