connect event not called after a delay celery task #1888
-
Here is the # extensions.py file
from flask_socketio import SocketIO
socketio = SocketIO(manage_session=False,
message_queue='redis://redis:6379/0',
async_mode="threading",
cors_allowed_origins='*',
logger=True,
engineio_logger=True) # app.py file
from flask import Flask
from app.exetensions import socketio
def create_app():
app = Flask(__name__, instance_relative_config=True)
socketio.init_app(app,
message_queue='redis://redis:6379/0',
async_mode='threading',
logger=True,
engineio_logger=True)
@socketio.event
def connect():
app.logger.info('[*] Connect event')
socketio.emit('after_connect', {'data': 'some data'})
if __name__ == '__main__':
socketio.run(app)
return app The app is execute from
Here is some log after the celery task
When the app execute a celery task for the fist time, everything goes well but after the celery task, if the browser is refresh,
. The client listening for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 14 replies
-
You are using the threading async mode. Why are you running gunicorn with the gevent worker? |
Beta Was this translation helpful? Give feedback.
You are using the threading async mode. Why are you running gunicorn with the gevent worker?