forked from OpenNeo/impress
use resque-retry to reschedule failed jobs
This commit is contained in:
parent
9eaeadaa8c
commit
43f373fc36
8 changed files with 29 additions and 0 deletions
1
Gemfile
1
Gemfile
|
@ -26,6 +26,7 @@ gem 'whenever', '~> 0.6.2', :require => false
|
||||||
gem 'swf_converter', '~> 0.0.3'
|
gem 'swf_converter', '~> 0.0.3'
|
||||||
|
|
||||||
gem 'resque', '~> 1.15.0'
|
gem 'resque', '~> 1.15.0'
|
||||||
|
gem 'resque-retry', '~> 0.1.0'
|
||||||
|
|
||||||
gem 'right_aws', '~> 2.1.0'
|
gem 'right_aws', '~> 2.1.0'
|
||||||
|
|
||||||
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -139,6 +139,13 @@ GEM
|
||||||
redis-namespace (>= 0.10.0)
|
redis-namespace (>= 0.10.0)
|
||||||
sinatra (>= 0.9.2)
|
sinatra (>= 0.9.2)
|
||||||
vegas (~> 0.1.2)
|
vegas (~> 0.1.2)
|
||||||
|
resque-retry (0.1.0)
|
||||||
|
resque (>= 1.8.0)
|
||||||
|
resque-scheduler (>= 1.8.0)
|
||||||
|
resque-scheduler (1.9.9)
|
||||||
|
redis (>= 2.0.1)
|
||||||
|
resque (>= 1.8.0)
|
||||||
|
rufus-scheduler
|
||||||
right_aws (2.1.0)
|
right_aws (2.1.0)
|
||||||
right_http_connection (>= 1.2.5)
|
right_http_connection (>= 1.2.5)
|
||||||
right_http_connection (1.3.0)
|
right_http_connection (1.3.0)
|
||||||
|
@ -155,6 +162,8 @@ GEM
|
||||||
rspec-rails (2.0.1)
|
rspec-rails (2.0.1)
|
||||||
rspec (~> 2.0.0)
|
rspec (~> 2.0.0)
|
||||||
ruby-hmac (0.4.0)
|
ruby-hmac (0.4.0)
|
||||||
|
rufus-scheduler (2.0.9)
|
||||||
|
tzinfo (>= 0.3.23)
|
||||||
sinatra (1.2.6)
|
sinatra (1.2.6)
|
||||||
rack (~> 1.1)
|
rack (~> 1.1)
|
||||||
tilt (< 2.0, >= 1.2.2)
|
tilt (< 2.0, >= 1.2.2)
|
||||||
|
@ -200,6 +209,7 @@ DEPENDENCIES
|
||||||
rails (= 3.0.4)
|
rails (= 3.0.4)
|
||||||
rdiscount (~> 1.6.5)
|
rdiscount (~> 1.6.5)
|
||||||
resque (~> 1.15.0)
|
resque (~> 1.15.0)
|
||||||
|
resque-retry (~> 0.1.0)
|
||||||
right_aws (~> 2.1.0)
|
right_aws (~> 2.1.0)
|
||||||
rspec-rails (~> 2.0.0.beta.22)
|
rspec-rails (~> 2.0.0.beta.22)
|
||||||
swf_converter (~> 0.0.3)
|
swf_converter (~> 0.0.3)
|
||||||
|
|
2
Rakefile
2
Rakefile
|
@ -6,6 +6,8 @@ require File.expand_path('../config/application', __FILE__)
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
require 'rake/rdoctask'
|
require 'rake/rdoctask'
|
||||||
|
require 'resque/tasks'
|
||||||
|
require 'resque_scheduler/tasks'
|
||||||
|
|
||||||
OpenneoImpressItems::Application.load_tasks
|
OpenneoImpressItems::Application.load_tasks
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
|
require 'resque-retry'
|
||||||
|
|
||||||
class AssetImageConversionRequest
|
class AssetImageConversionRequest
|
||||||
|
extend Resque::Plugins::Retry
|
||||||
|
|
||||||
|
@retry_limit = 5
|
||||||
|
@retry_delay = 60
|
||||||
|
|
||||||
@queue = :requested_asset_images
|
@queue = :requested_asset_images
|
||||||
|
|
||||||
def self.perform(asset_type, asset_id)
|
def self.perform(asset_type, asset_id)
|
||||||
|
@ -7,6 +14,9 @@ class AssetImageConversionRequest
|
||||||
end
|
end
|
||||||
|
|
||||||
class OnCreation < AssetImageConversionRequest
|
class OnCreation < AssetImageConversionRequest
|
||||||
|
@retry_limit = 5
|
||||||
|
@retry_delay = 60
|
||||||
|
|
||||||
@queue = :requested_asset_images_on_creation
|
@queue = :requested_asset_images_on_creation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
6
config/initializers/resque_retry.rb
Normal file
6
config/initializers/resque_retry.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
require 'resque-retry'
|
||||||
|
require 'resque/failure/redis'
|
||||||
|
|
||||||
|
Resque::Failure::MultipleWithRetrySuppression.classes = [Resque::Failure::Redis]
|
||||||
|
Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression
|
||||||
|
|
BIN
vendor/cache/resque-retry-0.1.0.gem
vendored
Normal file
BIN
vendor/cache/resque-retry-0.1.0.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/resque-scheduler-1.9.9.gem
vendored
Normal file
BIN
vendor/cache/resque-scheduler-1.9.9.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rufus-scheduler-2.0.9.gem
vendored
Normal file
BIN
vendor/cache/rufus-scheduler-2.0.9.gem
vendored
Normal file
Binary file not shown.
Loading…
Reference in a new issue