melinath / django-daguerre

On-the-fly image manipulation for Django.
http://django-daguerre.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
85 stars 15 forks source link

Possible race condition when used with S3. #27

Open melinath opened 11 years ago

melinath commented 11 years ago

I'm not entirely sure what's going on. Daguerre occasionally runs into an issue where a file that's been saved can't be immediately opened to find its dimensions. The cause seems to be a race condition between the save and open, perhaps due to propagation of the file across s3 instances?

I think the correct solution is to pre-cache the image dimensions (which we already know) on the ImageFileField instance.

melinath commented 11 years ago

That method won't work. At least not easily. FileFields explicitly reload their files when they're saved - which makes sense since it means that the filefield on the saved instance will actually be the file that exists in the wild. However, it means there's no way for us to intercept the new FieldFile without overriding the save method by creating a new FileField subclass. Which we could do.