aboutsummaryrefslogtreecommitdiffstats
path: root/lib/collector/event_queue.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/collector/event_queue.rb')
-rw-r--r--lib/collector/event_queue.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/collector/event_queue.rb b/lib/collector/event_queue.rb
index 3851d82..2686cdd 100644
--- a/lib/collector/event_queue.rb
+++ b/lib/collector/event_queue.rb
@@ -37,10 +37,12 @@ module Collector
Retweet.delete_bulk_from_json(deletes)
end
- tweet_ids = favorites.map {|f| f[:target_object][:id] }
- if tweet_ids.size > 0
- Tweet.where(id: tweet_ids).each do |tweet|
- Notification.try_notify_favorites(tweet)
+ if Settings.notification.enabled?
+ tweet_ids = favorites.map {|f| f[:target_object][:id] }
+ if tweet_ids.size > 0
+ Tweet.where(id: tweet_ids).each do |tweet|
+ TweetResponseNotificationJob.perform_later(tweet)
+ end
end
end
@@ -93,8 +95,10 @@ module Collector
private
def cache(object)
if id = object[:identifier]
- unless @dalli.get(id)
- @dalli.set(id, true)
+ key, val = id.split("#", 2)
+ cur = @dalli.get(id)
+ if !cur || (val && (cur <=> val) == -1) # not found or new
+ @dalli.set(key, true || value)
yield
end
else