Add comment to integration platform helper about blocking I/O (#112103)

This commit is contained in:
J. Nick Koston 2024-03-03 07:00:35 -10:00 committed by GitHub
parent 7af82161a0
commit a37c82e34c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,16 @@ def _get_platform(
)
return None
#
# Loading the platform may do quite a bit of blocking I/O
# and CPU work. (https://github.com/python/cpython/issues/92041)
#
# We don't want to block the event loop for too
# long so we check if the platform exists with `platform_exists`
# before trying to load it. `platform_exists` will do two
# `stat()` system calls which is far cheaper than calling
# `integration.get_platform`
#
if integration.platform_exists(platform_name) is False:
# If the platform cannot possibly exist, don't bother trying to load it
return None