Use synchronous Redis delivery when gevent is monkey-patched but no gevent hub is driving the process — e.g. Celery prefork workers that inherit gevent patching from uWSGI imports. gevent.spawn in that context schedules coroutines that never run.
()
| 407 | |
| 408 | |
| 409 | def _should_use_sync_websocket_send(): |
| 410 | """ |
| 411 | Use synchronous Redis delivery when gevent is monkey-patched but no gevent |
| 412 | hub is driving the process — e.g. Celery prefork workers that inherit |
| 413 | gevent patching from uWSGI imports. gevent.spawn in that context schedules |
| 414 | coroutines that never run. |
| 415 | """ |
| 416 | return _is_gevent_monkey_patched() and _is_celery_worker_context() |
| 417 | |
| 418 | |
| 419 | def _gevent_ws_send(group_name, message): |