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

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

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

Comments

Projects
None yet
3 participants
@reichertm

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

This comment has been minimized.

Show comment
Hide comment
@morgoth

morgoth Aug 22, 2016

Contributor

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?

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

This comment has been minimized.

Show comment
Hide comment
@reichertm

reichertm Aug 22, 2016

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

reichertm commented Aug 22, 2016

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

@sidraval

This comment has been minimized.

Show comment
Hide comment
@sidraval

sidraval Apr 27, 2018

Member

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

Member

sidraval commented Apr 27, 2018

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

@sidraval sidraval closed this Apr 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment