photos are now successfully delayed

This commit is contained in:
maxwell 2011-03-15 17:59:56 -07:00
parent b987b47f5f
commit bca184eaf3
5 changed files with 14 additions and 2 deletions

View file

@ -56,7 +56,7 @@ class StatusMessagesController < ApplicationController
end end
end end
photos.update_all(:pending => false, :public => public_flag) photos.update_all(:pending => false, :public => public_flag)
photos.each{|x| x.queue_post_process} photos.each{|x| x.queue_processing_job; puts "i did it"}
end end
if request.env['HTTP_REFERER'].include?("people") if request.env['HTTP_REFERER'].include?("people")

View file

@ -7,7 +7,14 @@ module Job
class ProcessPhoto < Base class ProcessPhoto < Base
@queue = :photos @queue = :photos
def self.perform_delegate(photo_id) def self.perform_delegate(photo_id)
begin
Photo.find(photo_id).image.post_process Photo.find(photo_id).image.post_process
rescue Exception => e
puts e.inspect
ensure
puts "photo has been processed"
end
end end
end end
end end

View file

@ -18,6 +18,7 @@ class ImageUploader < CarrierWave::Uploader::Base
end end
def post_process def post_process
self.send(:remove_versions!)
unless self.file.file.include? '.gif' unless self.file.file.include? '.gif'
ImageUploader.instance_eval do ImageUploader.instance_eval do
version :thumb_small do version :thumb_small do

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -158,6 +158,10 @@ describe StatusMessagesController do
@photo1.reload.pending.should be_false @photo1.reload.pending.should be_false
@photo2.reload.pending.should be_false @photo2.reload.pending.should be_false
end end
it 'queues all photos to be processed' do
pending
end
end end
end end