Flask-SocketIO emit not working in a start_background_task #2036
-
Hi, Functional Requirement: An endpoint which returns an event_id and to which our client can listen to.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Long running processes do not work well with eventlet. I recommend you try installing eventlet and switching to the |
Beta Was this translation helpful? Give feedback.
-
Thanks @miguelgrinberg for your prompt attention. I tried to use threading async mode by setting the following
|
Beta Was this translation helpful? Give feedback.
-
Adding socketio.sleep(0) in long running process fixes the issue. Thanks @miguelgrinberg |
Beta Was this translation helpful? Give feedback.
You are using eventlet, which does not work well with long running tasks. Your two options are 1) add frequent sleep(0) calls while the long task runs, or 2) use threading instead of eventlet.