Skip to content

Commit 29ad2e6

Browse files
committed
Avoid import of pkg_resource with Starlette integration
By changing the order in the condition, we can avoid the call to `_get_installed_modules` (which imports `pkg_resources`) when the `mechanism_type` is set to `"starlette"`.
1 parent de84c4c commit 29ad2e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sentry_sdk/integrations/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(
108108
)
109109

110110
asgi_middleware_while_using_starlette_or_fastapi = (
111-
"starlette" in _get_installed_modules() and mechanism_type == "asgi"
111+
mechanism_type == "asgi" and "starlette" in _get_installed_modules()
112112
)
113113
if asgi_middleware_while_using_starlette_or_fastapi:
114114
logger.warning(

0 commit comments

Comments
 (0)