diff --git a/Gemfile b/Gemfile index eb868219..c3e6267f 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ gem 'whenever', '~> 0.6.2', :require => false gem 'swf_converter', '~> 0.0.3' gem 'resque', '~> 1.15.0' +gem 'resque-retry', '~> 0.1.0' gem 'right_aws', '~> 2.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 1877bd0e..b8cf3020 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -139,6 +139,13 @@ GEM redis-namespace (>= 0.10.0) sinatra (>= 0.9.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_http_connection (>= 1.2.5) right_http_connection (1.3.0) @@ -155,6 +162,8 @@ GEM rspec-rails (2.0.1) rspec (~> 2.0.0) ruby-hmac (0.4.0) + rufus-scheduler (2.0.9) + tzinfo (>= 0.3.23) sinatra (1.2.6) rack (~> 1.1) tilt (< 2.0, >= 1.2.2) @@ -200,6 +209,7 @@ DEPENDENCIES rails (= 3.0.4) rdiscount (~> 1.6.5) resque (~> 1.15.0) + resque-retry (~> 0.1.0) right_aws (~> 2.1.0) rspec-rails (~> 2.0.0.beta.22) swf_converter (~> 0.0.3) diff --git a/Rakefile b/Rakefile index 927f8f09..e340041e 100644 --- a/Rakefile +++ b/Rakefile @@ -6,6 +6,8 @@ require File.expand_path('../config/application', __FILE__) require 'rake' require 'rake/testtask' require 'rake/rdoctask' +require 'resque/tasks' +require 'resque_scheduler/tasks' OpenneoImpressItems::Application.load_tasks diff --git a/app/models/asset_image_conversion_request.rb b/app/models/asset_image_conversion_request.rb index 2d5d1a09..0ebc550a 100644 --- a/app/models/asset_image_conversion_request.rb +++ b/app/models/asset_image_conversion_request.rb @@ -1,4 +1,11 @@ +require 'resque-retry' + class AssetImageConversionRequest + extend Resque::Plugins::Retry + + @retry_limit = 5 + @retry_delay = 60 + @queue = :requested_asset_images def self.perform(asset_type, asset_id) @@ -7,6 +14,9 @@ class AssetImageConversionRequest end class OnCreation < AssetImageConversionRequest + @retry_limit = 5 + @retry_delay = 60 + @queue = :requested_asset_images_on_creation end end diff --git a/config/initializers/resque_retry.rb b/config/initializers/resque_retry.rb new file mode 100644 index 00000000..2a7902fe --- /dev/null +++ b/config/initializers/resque_retry.rb @@ -0,0 +1,6 @@ +require 'resque-retry' +require 'resque/failure/redis' + +Resque::Failure::MultipleWithRetrySuppression.classes = [Resque::Failure::Redis] +Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression + diff --git a/vendor/cache/resque-retry-0.1.0.gem b/vendor/cache/resque-retry-0.1.0.gem new file mode 100644 index 00000000..0f0aa49b Binary files /dev/null and b/vendor/cache/resque-retry-0.1.0.gem differ diff --git a/vendor/cache/resque-scheduler-1.9.9.gem b/vendor/cache/resque-scheduler-1.9.9.gem new file mode 100644 index 00000000..7a18ae9c Binary files /dev/null and b/vendor/cache/resque-scheduler-1.9.9.gem differ diff --git a/vendor/cache/rufus-scheduler-2.0.9.gem b/vendor/cache/rufus-scheduler-2.0.9.gem new file mode 100644 index 00000000..b3f31d49 Binary files /dev/null and b/vendor/cache/rufus-scheduler-2.0.9.gem differ