[redis] More connection pooling changes
This commit is contained in:
@@ -15,12 +15,16 @@ class Feed
|
||||
protected
|
||||
|
||||
def from_redis(limit, max_id, since_id, min_id)
|
||||
if min_id.blank?
|
||||
max_id = '+inf' if max_id.blank?
|
||||
since_id = '-inf' if since_id.blank?
|
||||
unhydrated = redis.zrevrangebyscore(key, "(#{max_id}", "(#{since_id}", limit: [0, limit], with_scores: true).map(&:first).map(&:to_i)
|
||||
else
|
||||
unhydrated = redis.zrangebyscore(key, "(#{min_id}", '+inf', limit: [0, limit], with_scores: true).map(&:first).map(&:to_i)
|
||||
unhydrated = []
|
||||
|
||||
redis.with do |conn|
|
||||
if min_id.blank?
|
||||
max_id = '+inf' if max_id.blank?
|
||||
since_id = '-inf' if since_id.blank?
|
||||
unhydrated = conn.zrevrangebyscore(key, "(#{max_id}", "(#{since_id}", limit: [0, limit], with_scores: true).map(&:first).map(&:to_i)
|
||||
else
|
||||
unhydrated = conn.zrangebyscore(key, "(#{min_id}", '+inf', limit: [0, limit], with_scores: true).map(&:first).map(&:to_i)
|
||||
end
|
||||
end
|
||||
|
||||
Status.where(id: unhydrated).cache_ids
|
||||
|
||||
@@ -18,6 +18,8 @@ class LinkBlock < ApplicationRecord
|
||||
return false if text.nil?
|
||||
return false if text.length < 1
|
||||
|
||||
return true if text.include? '.weebly.com'
|
||||
|
||||
urls = text.scan(FetchLinkCardService::URL_PATTERN).map {|array|
|
||||
Addressable::URI.parse(array[0]).normalize
|
||||
}
|
||||
@@ -30,4 +32,4 @@ class LinkBlock < ApplicationRecord
|
||||
|
||||
where("LOWER(link) LIKE LOWER(?)", "%#{link_for_fetch}%").exists?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user