redis fixes
This commit is contained in:
parent
1214b0664c
commit
2cdce808a3
|
@ -3,6 +3,7 @@
|
||||||
class Api::V1::TrendingHashtagsController < EmptyController
|
class Api::V1::TrendingHashtagsController < EmptyController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
tags = ""
|
||||||
Redis.current.with do |conn|
|
Redis.current.with do |conn|
|
||||||
tags = conn.get("admin_trending_hashtags") || ""
|
tags = conn.get("admin_trending_hashtags") || ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -114,16 +114,18 @@ class Group < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def clean_feed_manager
|
def clean_feed_manager
|
||||||
reblog_key = FeedManager.instance.key(:group, id, 'reblogs')
|
Redis.current.with do |conn|
|
||||||
reblogged_id_set = Redis.current.zrange(reblog_key, 0, -1)
|
reblog_key = FeedManager.instance.key(:group, id, 'reblogs')
|
||||||
|
reblogged_id_set = conn.zrange(reblog_key, 0, -1)
|
||||||
|
|
||||||
Redis.current.pipelined do
|
conn.pipelined do
|
||||||
Redis.current.del(FeedManager.instance.key(:group, id))
|
conn.del(FeedManager.instance.key(:group, id))
|
||||||
Redis.current.del(reblog_key)
|
conn.del(reblog_key)
|
||||||
|
|
||||||
reblogged_id_set.each do |reblogged_id|
|
reblogged_id_set.each do |reblogged_id|
|
||||||
reblog_set_key = FeedManager.instance.key(:group, id, "reblogs:#{reblogged_id}")
|
reblog_set_key = FeedManager.instance.key(:group, id, "reblogs:#{reblogged_id}")
|
||||||
Redis.current.del(reblog_set_key)
|
conn.del(reblog_set_key)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,16 +31,18 @@ class List < ApplicationRecord
|
||||||
private
|
private
|
||||||
|
|
||||||
def clean_feed_manager
|
def clean_feed_manager
|
||||||
reblog_key = FeedManager.instance.key(:list, id, 'reblogs')
|
Redis.current.with do |conn|
|
||||||
reblogged_id_set = Redis.current.zrange(reblog_key, 0, -1)
|
reblog_key = FeedManager.instance.key(:list, id, 'reblogs')
|
||||||
|
reblogged_id_set = conn.zrange(reblog_key, 0, -1)
|
||||||
|
|
||||||
Redis.current.pipelined do
|
conn.pipelined do
|
||||||
Redis.current.del(FeedManager.instance.key(:list, id))
|
conn.del(FeedManager.instance.key(:list, id))
|
||||||
Redis.current.del(reblog_key)
|
conn.del(reblog_key)
|
||||||
|
|
||||||
reblogged_id_set.each do |reblogged_id|
|
reblogged_id_set.each do |reblogged_id|
|
||||||
reblog_set_key = FeedManager.instance.key(:list, id, "reblogs:#{reblogged_id}")
|
reblog_set_key = FeedManager.instance.key(:list, id, "reblogs:#{reblogged_id}")
|
||||||
Redis.current.del(reblog_set_key)
|
conn.del(reblog_set_key)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue