Customized Resque-Retry by worker #11

Open
wants to merge 1 commit into
from
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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