Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Handling event_loop in _worker_process #822

@jakirkham

Description

@jakirkham

Currently _worker_process calls asyncio.get_event_loop()

loop = asyncio.get_event_loop()

This function was deprecated in Python 3.10 ( https://bugs.python.org/issue39529 ). The docs recommend calling asyncio.get_running_loop() instead. Though this will raise a RuntimeError if an event loop doesn't exist.

This raises an interesting question. Should this function create an event loop (possibly not if something else has already done this)? Should this function be taking an event_loop as an argument (like other functions do)? Guessing no since it is called in different processes. Should it take a function to create an event loop ( for example if we want to use uvloop #821 )? Or should it do something else (like try to use an existing event loop and only create one if it is absent)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions