Skip to content

Sync serializer/deserializer calls block the async event loop #145

@lukasjesche

Description

@lukasjesche

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions