jstorimer / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
https://github.com/jrgifford/delayed_paperclip/
392 stars 245 forks source link

image_processing set to false before s3 write finishes #71

Open jaredmoody opened 11 years ago

jaredmoody commented 11 years ago

I'm occasionally getting 406 responses from s3 after requesting an image that just finished processing. I put in debug lines in paperclip/storage/s3.rb flush_writes and delayed_paperclip/attachment.rb post_process_styles_with_processing and it looks to me like the _processing column is getting set to false just before the writes are flushed to s3, which seems like a bug to me.

Has anyone else seen this happening? Not sure what the best approach is here as I'm not too familiar with paperclip internals and not sure if this is a paperclip or delayed_paperclip problem.

I'm using ree-1.8.7-2012.02, paperclip 2.7.1, and delayed_paperclip 2.4.5.2

jrgifford commented 11 years ago

It might be a paperclip problem, we are running a ancient version of paperclip right now. I'm working on updating paperclip to 3.0, so this might resolve the problem.

Can you try this branch?

jaredmoody commented 11 years ago

I can't use the paperclip 3 branch since I'm not on ruby 1.9.3 yet, so until then I'm on paperclip 2.7.1. Should I try the master branch from your fork or is that the same as 2.4.5.2?

jaredmoody commented 11 years ago

Here's a solution that's working for me:

https://github.com/elevation/delayed_paperclip/commit/15c670a3f9045bddd858dd6f603e15bf53de1b58

I just changed the alias method chain to hook into after_flush_writes instead of post_process_styles.

That work?

jrgifford commented 11 years ago

Master is (with a few minor diffs) the same as the current release.

Also, that gist is deleted - can you repost?

jaredmoody commented 11 years ago

I updated my post to point to the commit in my fork, sorry about that. Refresh?

jrgifford commented 11 years ago

Ah, ok. I see it now. Thanks!