-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
Django storage class instantiated every time #508
Comments
Sorry, it seems the culprit is here, when rendering images: https://github.com/jazzband/sorl-thumbnail/blob/master/sorl/thumbnail/images.py#L40 |
This appears to be the same bug as #301 It's particularly bad with the latest boto3 storage from django-storages, as it adds a large delay for each thumbnail generated. It looks to be due to the behavior of instantiating a new storage instance for each thumbnail when deserializing from the cache. What would fix it is having some module level variable to cache the storage instances. That way only a single storage instance would be initialized for each storage type. |
Duplicate of #301 |
https://github.com/jazzband/sorl-thumbnail/blob/master/sorl/thumbnail/default.py#L24
Is it needed that the storage class is created every time it's needed? What happens if the storage class has a slow constructor? This happens with a custom AWS S3 storage class, that will check for the bucket on class construction only.
The text was updated successfully, but these errors were encountered: