MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / _should_use_sync_websocket_send

Function _should_use_sync_websocket_send

core/utils.py:409–416  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

407
408
409def _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
419def _gevent_ws_send(group_name, message):

Calls 2