0
0
Fork 0

Create Redisable#redis (#9633)

* Create Redisable

* Use #redis instead of Redis.current
This commit is contained in:
ysksn 2019-02-03 03:11:38 +09:00 committed by Eugen Rochko
parent 6a5e3da6b0
commit bcfff65195
13 changed files with 39 additions and 59 deletions

View file

@ -4,6 +4,7 @@ require 'singleton'
class FeedManager
include Singleton
include Redisable
MAX_ITEMS = 400
@ -35,7 +36,7 @@ class FeedManager
def unpush_from_home(account, status)
return false unless remove_from_feed(:home, account.id, status)
Redis.current.publish("timeline:#{account.id}", Oj.dump(event: :delete, payload: status.id.to_s))
redis.publish("timeline:#{account.id}", Oj.dump(event: :delete, payload: status.id.to_s))
true
end
@ -53,7 +54,7 @@ class FeedManager
def unpush_from_list(list, status)
return false unless remove_from_feed(:list, list.id, status)
Redis.current.publish("timeline:list:#{list.id}", Oj.dump(event: :delete, payload: status.id.to_s))
redis.publish("timeline:list:#{list.id}", Oj.dump(event: :delete, payload: status.id.to_s))
true
end
@ -142,10 +143,6 @@ class FeedManager
private
def redis
Redis.current
end
def push_update_required?(timeline_id)
redis.exists("subscribed:#{timeline_id}")
end