Skip to content
Browse files

Disabling moderator tweeting worker thread

  • Loading branch information...
1 parent fbd98d9 commit d14d3ffbdb20ce59be4c6ec6b26cf36ca4684ad7 @adahmash adahmash committed Apr 2, 2012
Showing with 3 additions and 6 deletions.
  1. +0 −5 app/workers/twitter_scheduled_worker.rb
  2. +3 −1 lib/tweeter.rb
View
5 app/workers/twitter_scheduled_worker.rb
@@ -7,11 +7,6 @@ def self.perform
rescue Newscloud::TweeterDisabled => e
Rails.logger.info("ERROR:: TwitterScheduledWorker failed with: #{e.inspect}")
end
- begin
- Newscloud::Tweeter.new.tweet_moderator_items
- rescue Newscloud::TweeterDisabled => e
- Rails.logger.info("ERROR:: TwitterScheduledWorker failed with: #{e.inspect}")
- end
end
end
View
4 lib/tweeter.rb
@@ -167,11 +167,13 @@ def tweet_hot_items
end
end
+ # This functionality is not in use right now.
+ # Should we decide in the future to tweet all moderator items then
+ # we can reuse this code
def tweet_moderator_items
enabled = Metadata::Setting.find_setting('tweet_all_moderator_items').try(:value)
raise Newscloud::TweeterDisabled.new("You must enable the setting 'tweet_all_moderator_items' to use Tweeter.") unless enabled
klasses = Dir.glob("#{Rails.root}/app/models/*.rb").map {|f| f.sub(%r{^.*/(.*?).rb$}, '\1').pluralize.classify }.map {|s| s == "Metadatum" ? "Metadata" : s}.map(&:constantize).select {|m| m.respond_to?(:tweetable?) and m.tweetable? }
- puts "tweeting moderator items"
klasses.each do |klass|
begin
moderator_items = klass.moderator_items

0 comments on commit d14d3ff

Please sign in to comment.
Something went wrong with that request. Please try again.