0
0
Fork 0

Fix single Redis connection being used across all threads (#18135)

* Fix single Redis connection being used across all Sidekiq threads

* Fix tests
This commit is contained in:
Eugen Rochko 2022-04-28 17:47:34 +02:00 committed by GitHub
parent 9bf04db23a
commit 3917353645
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 243 additions and 124 deletions

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class FetchLinkCardService < BaseService
include Redisable
URL_PATTERN = %r{
(#{Twitter::TwitterText::Regex[:valid_url_preceding_chars]}) # $1 preceding chars
( # $2 URL
@ -155,6 +157,6 @@ class FetchLinkCardService < BaseService
end
def lock_options
{ redis: Redis.current, key: "fetch:#{@original_url}", autorelease: 15.minutes.seconds }
{ redis: redis, key: "fetch:#{@original_url}", autorelease: 15.minutes.seconds }
end
end