Skip to content

Commit f6af7a0

Browse files
mguantonpirker
andauthored
Avoid import of pkg_resource with Starlette integration (#1836)
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"`. Co-authored-by: Anton Pirker <[email protected]>
1 parent 3f38f79 commit f6af7a0

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
@@ -109,7 +109,7 @@ def __init__(
109109
)
110110

111111
asgi_middleware_while_using_starlette_or_fastapi = (
112-
"starlette" in _get_installed_modules() and mechanism_type == "asgi"
112+
mechanism_type == "asgi" and "starlette" in _get_installed_modules()
113113
)
114114
if asgi_middleware_while_using_starlette_or_fastapi:
115115
logger.warning(

0 commit comments

Comments
 (0)