jrgifford / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
http://www.jstorimer.com/ruby/2010/01/30/delayed-paperclip.html
MIT License
402 stars 155 forks source link

Non-Delayed Paperclip attachment file_name, etc. not being removed instantly. #85

Open dustmoo opened 10 years ago

dustmoo commented 10 years ago

I had implemented delayed_paperclip for a model that had a large attachment with a custom processor and it worked great.

For some reason, however, I am getting odd behavior from other models paperclip attachments that are not delayed. (I am not using process_in_background anywhere in the model definition )

The attachments are uploading fine and without any kind of handoff to delayed job. When I try to destroy an attachment, the behavior changes. The attachment deletes, and is even removed from S3, but it seems that the attachment_file_name and reference to the attachment are not cleared.

After the attachment is destroyed (which returns true), I save my model (also returns true) and then redirect to my show view. The view is responding as if the attachment still exists, but now with a broken link since the actual file has been removed. If I refresh a few seconds later, the view behaves properly.

In console here is my result

model.attachment.destroy => true
model.attachment => "/images/original/missing.png"
model.save => true
model.attachment => "http://s3.amazonaws.com/mys3bucketname/attachments/159012/original/OriginalFileName.psd?1398985932"

When I removed the delayed_paperclip gem this worked as expected properly destroying the attachment. What is happening here?

Thanks for your time, it is an awesome gem. I just need to resolve this issue.

ScotterC commented 9 years ago

Hey @dustmoo does this still happen on the latest version of Delayed Paperclip? 2.8.0?

dustmoo commented 9 years ago

I can’t say, I ended up reverting back to the regular version of Paperclip for my project and created my own “queue”, it doesn’t work as well as this gem, but this problem was a deal-breaker. If I have some extra time this spring I will refactor my project to use this again and see if everything is happy.

On Mon, Dec 22, 2014 at 6:59 PM, Scott Carleton notifications@github.com wrote:

Hey @dustmoo does this still happen on the latest version of Delayed Paperclip? 2.8.0?

Reply to this email directly or view it on GitHub: https://github.com/jrgifford/delayed_paperclip/issues/85#issuecomment-67917400