Skip to content

Commit

Permalink
Fix wrong pubsub channel on public timelines
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Apr 6, 2017
1 parent a9c0062 commit 51d7caa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions app/services/fan_out_on_write_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ def deliver_to_hashtags(status)
Rails.logger.debug "Delivering status #{status.id} to hashtags"

status.tags.pluck(:name).each do |hashtag|
Redis.current.publish("hashtag:#{hashtag}", @payload)
Redis.current.publish("hashtag:#{hashtag}:local", @payload) if status.local?
Redis.current.publish("timeline:hashtag:#{hashtag}", @payload)
Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if status.local?
end
end

def deliver_to_public(status)
Rails.logger.debug "Delivering status #{status.id} to public timeline"

Redis.current.publish('public', @payload)
Redis.current.publish('public:local', @payload) if status.local?
Redis.current.publish('timeline:public', @payload)
Redis.current.publish('timeline:public:local', @payload) if status.local?
end
end
8 changes: 4 additions & 4 deletions app/services/remove_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ def unpush(type, receiver, status)

def remove_from_hashtags(status)
status.tags.pluck(:name) do |hashtag|
Redis.current.publish("hashtag:#{hashtag}", @payload)
Redis.current.publish("hashtag:#{hashtag}:local", @payload) if status.local?
Redis.current.publish("timeline:hashtag:#{hashtag}", @payload)
Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if status.local?
end
end

def remove_from_public(status)
Redis.current.publish('public', @payload)
Redis.current.publish('public:local', @payload) if status.local?
Redis.current.publish('timeline:public', @payload)
Redis.current.publish('timeline:public:local', @payload) if status.local?
end

def redis
Expand Down

0 comments on commit 51d7caa

Please sign in to comment.