diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-06-19 11:44:18 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-06-19 11:44:18 +0900 |
commit | 4dc48453453bce1ff96ff2929518ae97c53428ae (patch) | |
tree | 86ded1a3da2df67376a0520bc84693b927b7002b /lib/collector | |
parent | 2e1eea7875b192ba329c2c24852ea11069fe7f94 (diff) | |
parent | a59a717406fcba7b229739508289fb03c3599357 (diff) | |
download | aclog-4dc48453453bce1ff96ff2929518ae97c53428ae.tar.gz |
Merge branch 'master' into collector-proxy
Diffstat (limited to 'lib/collector')
-rw-r--r-- | lib/collector/event_queue.rb | 16 |
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 |