Reputation: 928
My setup is flask-socketio with a flask-restful webserver.
Eventlet is installed, so in production mode, eventlet webserver is used.
I understand flask-socketio and eventlet webserver themselves are event-loop based.
Does flask-socketio and eventlet webserver runs on the same eventloop (same thread) or in two different threads?
Upvotes: 0
Views: 1056
Reputation: 67479
I think you are confusing the terminology.
The event loop is the task scheduler. This is provided by eventlet, and a single event loop is used for the whole application, including the Flask and the Flask-SocketIO parts.
Each time a request arrives to the eventlet web server, it will allocate a new task for it. So basically each request (be it Flask or Flask-SocketIO, HTTP or WebSocket) will get its own task. Tasks are constantly being created and destroyed as requests are handled.
When you use eventlet, tasks are not threads, they are greenlets, that is why I avoided calling them threads above and used the more generic "task" term. They behave like threads in many ways, but they are not.
Upvotes: 1