Skip to content

Reduce the _load_runtime_context call lock #3781

@Chise1

Description

@Chise1

May be _load_runtime_context can be better:

def _load_runtime_context(func: _F) -> _F:
    @wraps(func)  # type: ignore[misc]
    def wrapper(  # type: ignore[misc]
        *args: typing.Tuple[typing.Any, typing.Any],
        **kwargs: typing.Dict[typing.Any, typing.Any],
    ) -> typing.Optional[typing.Any]:
        global _RUNTIME_CONTEXT  # pylint: disable=global-statement
        if _RUNTIME_CONTEXT is None:
            with _RUNTIME_CONTEXT_LOCK:
                if _RUNTIME_CONTEXT is not None:
                    return
               ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions