Skip to content

Reduce the _load_runtime_context call lock #3781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Chise1 opened this issue Mar 14, 2024 · 3 comments
Closed

Reduce the _load_runtime_context call lock #3781

Chise1 opened this issue Mar 14, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Chise1
Copy link

Chise1 commented Mar 14, 2024

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
               ...
@Chise1 Chise1 added the bug Something isn't working label Mar 14, 2024
@pmcollins
Copy link
Member

Hi @Chise1 does this PR address your concerns?

@Chise1
Copy link
Author

Chise1 commented Mar 14, 2024

yes.

@Chise1 Chise1 closed this as completed Mar 14, 2024
@pmcollins
Copy link
Member

Thanks -- can we close the related PR as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants