Skip to content

Utilise eager_task_factory in python >= 3.12 #1048

@abebus

Description

@abebus

Since Python 3.12, asyncio introduced an eager task factory, which allows tasks to start executing immediately after being spawned, rather than waiting until the event loop schedules them.

I believe this could be useful in cases where the coroutine is just a simple cached value getter. Using eager tasks could reduce latency in situations where:

  • The coroutine would otherwise be scheduled at the end of the queue, delaying an immediate result.
  • Some other coroutines are blocking by mistake, and we’d still want cache hits to return quickly.

It's just an idea, but the implementation seems fairly straightforward. If no one else wants to try doing it, I will open a PR in 1-2 months, things have been pretty busy lately

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