diff options
author | ysksn <bluewhale1982@gmail.com> | 2019-02-03 03:11:38 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-02-17 19:42:14 +0100 |
commit | 737ac4b59df77e43bed71abc6de80bc89f893de1 (patch) | |
tree | d312fb754ed830b2de595905a5e6287f96555d55 /app/services/remove_status_service.rb | |
parent | 17a41e1f779874a270f531086f5576affcdb6cb1 (diff) |
Create Redisable#redis (#9633)
* Create Redisable
* Use #redis instead of Redis.current
Diffstat (limited to 'app/services/remove_status_service.rb')
-rw-r--r-- | app/services/remove_status_service.rb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 11d28e783d0..28c5224b011 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -2,6 +2,7 @@ class RemoveStatusService < BaseService include StreamEntryRenderer + include Redisable def call(status, **options) @payload = Oj.dump(event: :delete, payload: status.id.to_s) @@ -55,7 +56,7 @@ class RemoveStatusService < BaseService def remove_from_affected @mentions.map(&:account).select(&:local?).each do |account| - Redis.current.publish("timeline:#{account.id}", @payload) + redis.publish("timeline:#{account.id}", @payload) end end @@ -133,26 +134,22 @@ class RemoveStatusService < BaseService return unless @status.public_visibility? @tags.each do |hashtag| - Redis.current.publish("timeline:hashtag:#{hashtag}", @payload) - Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local? + redis.publish("timeline:hashtag:#{hashtag}", @payload) + redis.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local? end end def remove_from_public return unless @status.public_visibility? - Redis.current.publish('timeline:public', @payload) - Redis.current.publish('timeline:public:local', @payload) if @status.local? + redis.publish('timeline:public', @payload) + redis.publish('timeline:public:local', @payload) if @status.local? end def remove_from_media return unless @status.public_visibility? - Redis.current.publish('timeline:public:media', @payload) - Redis.current.publish('timeline:public:local:media', @payload) if @status.local? - end - - def redis - Redis.current + redis.publish('timeline:public:media', @payload) + redis.publish('timeline:public:local:media', @payload) if @status.local? end end |