Hello!
The serialize() and deserialize() methods on the Worker are synchronous and called directly from async methods without being offloaded to a thread. For non-trivial payloads or serializers, this can blocks the event loop and can stall the entire worker.
This could either be fixed by offloading the sync serializer/deserializer calls to a worker thread via anyio.to_thread.run_sync() or allow the Worker to accept async serializer/deserializer callables instead that can run async agnostic.
Environment:
streaq version: 6.2.1 (also affects earlier versions)
Reviewed from master branch, streaq/worker.py
Hello!
The
serialize()anddeserialize()methods on theWorkerare synchronous and called directly from async methods without being offloaded to a thread. For non-trivial payloads or serializers, this can blocks the event loop and can stall the entire worker.This could either be fixed by offloading the sync serializer/deserializer calls to a worker thread via anyio.to_thread.run_sync() or allow the
Workerto accept async serializer/deserializer callables instead that can run async agnostic.Environment:
streaq version: 6.2.1 (also affects earlier versions)
Reviewed from master branch, streaq/worker.py