Skip to content

Commit

Permalink
Check getcurrent before warning
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgigante authored Sep 8, 2024
1 parent 7941381 commit 1272517
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions django_s3_storage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,12 @@ def _setup(self):
f"Setting AWS_S3_BUCKET_NAME{self.s3_settings_suffix} is required."
)
if "gevent" in sys.modules and self.settings.AWS_S3_USE_THREADS:
warnings.warn(
"boto3 and gevent interaction likely. "
"Please set AWS_S3_USE_THREADS to False."
)
import gevent
if gevent.getcurrent().parent is not None:
warnings.warn(
"boto3 and gevent interaction likely. "
"Please set AWS_S3_USE_THREADS to False."
)
# Create a thread-local connection manager.
self._connections = _Local(self)
# Set transfer config for S3 operations
Expand Down

0 comments on commit 1272517

Please sign in to comment.