The Error :
2010-10-06T04:40:41-0700: * [Worker(delayed_job host:domU-12-31-39-0C-CC-64 pid:21517)] acquired lock on PhotoJob
2010-10-06T04:40:41-0700: * [JOB] delayed_job host:domU-12-31-39-0C-CC-64 pid:21517 failed with AWS::S3::NoSuchKey: The specified key does not exist. - 1 failed attempts
Paperclip matches the ID, but the ID suddenly doesn't match the AWS::Key. But if I run on my server Photo.find(:id).photo.reprocess!
, then it works.. So that tells me that there's nothing wrong with the ID. There's just something wrong with how/when its calling that key.
This problem does not occur on my local or on my testing server.
Big Note: Delayed_Jobs keeps trying to process it. Eventually it does get the key right, and it does work. It just takes quite a long time.
Another big note: This problem started occurring after I made the #{Rails.env} variable in my bucket. I also noticed that delayed_jobs was looking for a different release as well and it is failing to even find the photo.id. How could that have happened?
Any ideas?
Paperclip saves the file to the S3 bucket.
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => "photos/:id/:style/:basename.:extension",
:bucket => "hq-photo/#{Rails.env}/system" # TODO: #{Rails.env}
Then it runs this method from the photo.rb
model :
after_save do |image|
if image.source_changed?
Delayed::Job.enqueue PhotoJob.new(image.id)
end
end
def regenerate_styles!
self.photo.reprocess!
self.processing = false
self.save(false)
end
This is Photo_Job.rb:
class PhotoJob < Struct.new(:image_id)
def perform
Photo.find(self.image_id).regenerate_styles!
end
end