Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Option to avoid checking for file existence before deletion. #2281

Closed
reichertm opened this issue Aug 19, 2016 · 3 comments
Closed

Option to avoid checking for file existence before deletion. #2281

reichertm opened this issue Aug 19, 2016 · 3 comments

Comments

@reichertm
Copy link

reichertm commented Aug 19, 2016

I'm using Paperclip with Amazon S3 and a request to delete the paperclip file (file.destroy) results in 2 AWS request for each file style. First is a HEAD request, another is the actual DELETE request. It seems like this happens because each file style is checked for existence before being scheduled to be deleted. As far as I understand it happens in queue_all_for_delete method: https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/attachment.rb#L563

If possible it might be a good idea to have an option to delete a file without prior checking for existence. It would be useful when the result is not important and would halve the S3 bill (the requests quickly add up when cleaning up large number of files) and reduce the operation time.

@morgoth
Copy link
Contributor

morgoth commented Aug 22, 2016

To actually avoid adding yet another option, wouldn't be better to always try to delete the file and catch errors for non existent ones?

@reichertm
Copy link
Author

Sure, if only this is good enough for all the supported types of storage.

@sidraval
Copy link
Contributor

Thank you for reporting this. Unfortunately, we will be deprecating Paperclip and therefore will not have the bandwidth to address this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants