Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Customized Resque-Retry by worker

Different workers now have different retry parameters
  • Loading branch information...
commit 5f246c87429b8fd865c29e1f64cb1c9c3328a1bf 1 parent ce5222f
@adahmash adahmash authored
View
6 app/workers/classifieds_worker.rb
@@ -1,6 +1,12 @@
class ClassifiedsWorker
+ extend Resque::Plugins::Retry
+
@queue = :classifieds
+ @retry_exceptions = []
+ @retry_limit = 0
+
+
# needs to run nightly
def self.perform()
admin = Metadata::Setting.find_setting('site_notification_user').value
View
5 app/workers/comment_messenger.rb
@@ -1,6 +1,11 @@
class CommentMessenger
+ extend Resque::Plugins::Retry
+
@queue = :comment_messenger
+ @retry_exceptions = []
+ @retry_limit = 0
+
def self.perform(comment_id, item_url, app_caption, image_url)
# TEMPORARILY DISABLE
return true
View
7 app/workers/feeds_worker.rb
@@ -1,6 +1,11 @@
class FeedsWorker
+ extend Resque::Plugins::Retry
+
@queue = :feeds
+ @retry_limit = 0
+ @retry_exceptions = []
+
def self.perform(feed_id = nil)
if feed_id
feed = Feed.enabled.active.find_by_id(feed_id)
@@ -10,4 +15,4 @@ def self.perform(feed_id = nil)
end
end
-end
+end
View
7 app/workers/notification_worker.rb
@@ -1,6 +1,11 @@
class NotificationWorker
+ extend Resque::Plugins::Retry
+
@queue = :notifications
+ @retry_limit = 0
+ @retry_exceptions = []
+
# Takes a PfeedItem and stringified PfeedItem.attemp_delivery method params
def self.perform(pfeed_item_id, ar_obj_klass_name, ar_obj_id, method_name_arr)
pfeed_item = PfeedItem.find(pfeed_item_id)
@@ -29,4 +34,4 @@ def self.perform(pfeed_item_id, ar_obj_klass_name, ar_obj_id, method_name_arr)
end
end
end
-end
+end
View
5 app/workers/reminders_worker.rb
@@ -1,6 +1,11 @@
class RemindersWorker
+ extend Resque::Plugins::Retry
+
@queue = :reminders
+ @retry_limit = 0
+ @retry_exceptions = []
+
# needs to run nightly
def self.perform()
admin = Metadata::Setting.find_setting('site_notification_user').value
View
5 app/workers/score_worker.rb
@@ -1,6 +1,11 @@
class ScoreWorker
+ extend Resque::Plugins::Retry
+
@queue = :scores
+ @retry_limit = 0
+ @retry_exceptions = []
+
# Takes a Scorable Type, Scorable ID, and the User ID responsible
def self.perform(scorable_type, scorable_id, user_id)
scorable = scorable_type.constantize.find(scorable_id)
View
6 app/workers/sitemap_worker.rb
@@ -1,8 +1,14 @@
require 'aws/s3'
class SitemapWorker
+ extend Resque::Plugins::Retry
+
@queue = :sitemaps
+ @retry_limit = 0
+ @retry_exceptions = []
+
+
def self.perform()
SitemapGenerator::Sitemap.verbose = false
SitemapGenerator::Sitemap.create
View
6 app/workers/tweet_streams_worker.rb
@@ -1,6 +1,10 @@
class TweetStreamsWorker
+ extend Resque::Plugins::Retry
+
@queue = :tweet_streams
+ @retry_limit = 5
+
def self.perform(tweet_stream_id = nil)
tweet_streams = []
if tweet_stream_id
@@ -16,4 +20,4 @@ def self.perform(tweet_stream_id = nil)
end
end
-end
+end
View
5 app/workers/twitter_scheduled_worker.rb
@@ -1,6 +1,11 @@
class TwitterScheduledWorker
+ extend Resque::Plugins::Retry
+
@queue = :twitter_scheduled
+ @retry_limit = 5
+
+
def self.perform
begin
Newscloud::Tweeter.new.tweet_hot_items
View
4 app/workers/twitter_worker.rb
@@ -1,6 +1,10 @@
class TwitterWorker
+ extend Resque::Plugins::Retry
+
@queue = :twitter
+ @retry_limit = 5
+
def self.perform(klass, id)
item = klass.constantize.find(id)
return false unless item
View
5 app/workers/vote_messenger.rb
@@ -1,5 +1,10 @@
class VoteMessenger
+ extend Resque::Plugins::Retry
+
@queue = :vote_messenger
+
+ @retry_limit = 0
+ @retry_exceptions = []
def self.perform(vote_id, item_url, app_caption, image_url)
# TEMPORARILY DISABLE
Please sign in to comment.
Something went wrong with that request. Please try again.