[redis] More connection pooling changes
This commit is contained in:
@@ -10,11 +10,16 @@ class VerifiedSuggestions
|
||||
|
||||
def set(account_ids)
|
||||
return if account_ids.nil? || account_ids.empty?
|
||||
redis.setex(KEY, EXPIRE_AFTER, account_ids)
|
||||
redis.with do |conn|
|
||||
conn.setex(KEY, EXPIRE_AFTER, account_ids)
|
||||
end
|
||||
end
|
||||
|
||||
def get(account_id)
|
||||
account_ids = redis.get(KEY)
|
||||
account_ids = []
|
||||
redis.with do |conn|
|
||||
account_ids = conn.get(KEY)
|
||||
end
|
||||
|
||||
if account_ids.nil? || account_ids.empty?
|
||||
account_ids = Account.searchable
|
||||
@@ -24,7 +29,7 @@ class VerifiedSuggestions
|
||||
.local
|
||||
.limit(MAX_ITEMS)
|
||||
.pluck(:id)
|
||||
|
||||
|
||||
set(account_ids) if account_ids.nil? || account_ids.empty?
|
||||
else
|
||||
account_ids = JSON.parse(account_ids)
|
||||
|
||||
Reference in New Issue
Block a user