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

Function _is_celery_worker_context

core/utils.py:399–406  ·  view source on GitHub ↗

True when executing inside an active Celery task (prefork worker).

()

Source from the content-addressed store, hash-verified

397
398
399def _is_celery_worker_context():
400 """True when executing inside an active Celery task (prefork worker)."""
401 try:
402 from celery import current_task
403 request = getattr(current_task, 'request', None)
404 return bool(request and getattr(request, 'id', None))
405 except Exception:
406 return False
407
408
409def _should_use_sync_websocket_send():

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected