Skip to content
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

Add gevent / boto3 threads warning #164

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions django_s3_storage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os
import posixpath
import shutil
import sys
import warnings
from contextlib import closing
from datetime import timezone
from functools import partial, wraps
Expand Down Expand Up @@ -198,6 +200,13 @@ def _setup(self):
raise ImproperlyConfigured(
f"Setting AWS_S3_BUCKET_NAME{self.s3_settings_suffix} is required."
)
if "gevent" in sys.modules and self.settings.AWS_S3_USE_THREADS:
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
Loading