We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c2a8a2 commit 7bc2914Copy full SHA for 7bc2914
lib/kredis/migration.rb
@@ -5,7 +5,6 @@ class Kredis::Migration
5
6
def initialize(config = :shared)
7
@redis = Kredis.configured_for config
8
- @pipeline = nil
9
# TODO: Replace script loading with `copy` command once Redis 6.2+ is the minimum supported version.
10
@copy_sha = @redis.script "load", "redis.call('SETNX', KEYS[2], redis.call('GET', KEYS[1])); return 1;"
11
end
@@ -40,10 +39,6 @@ def delete_all(key_pattern)
40
39
private
41
SCAN_BATCH_SIZE = 1_000
42
43
- def connection
44
- @pipeline || @redis
45
- end
46
-
47
def each_key_batch_matching(key_pattern, &block)
48
cursor = "0"
49
begin
lib/kredis/types/proxy.rb
@@ -2,7 +2,7 @@ class Kredis::Types::Proxy
2
require_relative "proxy/failsafe"
3
include Failsafe
4
- attr_accessor :redis, :key, :pipeline
+ attr_accessor :redis, :key
def initialize(redis, key, **options)
@redis, @key = redis, key
@@ -11,16 +11,17 @@ def initialize(redis, key, **options)
12
def multi(*args, **kwargs, &block)
13
redis.multi(*args, **kwargs) do |pipeline|
14
- self.pipeline = pipeline
+ Thread.current[:pipeline] = pipeline
15
block.call
16
- self.pipeline = nil
+ ensure
17
+ Thread.current[:pipeline] = nil
18
19
20
21
def method_missing(method, *args, **kwargs)
22
Kredis.instrument :proxy, **log_message(method, *args, **kwargs) do
23
failsafe do
- (pipeline || redis).public_send method, key, *args, **kwargs
24
+ (Thread.current[:pipeline] || redis).public_send method, key, *args, **kwargs
25
26
27
0 commit comments