photos are now successfully delayed
This commit is contained in:
parent
b987b47f5f
commit
bca184eaf3
5 changed files with 14 additions and 2 deletions
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
BIN
public/images/ajax-loader2.gif
Normal file
BIN
public/images/ajax-loader2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue