Class: OpenC3::StoreConnectionPool

Inherits:
ConnectionPool
  • Object
show all
Defined in:
lib/openc3/utilities/store_autoload.rb

Instance Method Summary collapse

Instance Method Details

#pipelinedObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/openc3/utilities/store_autoload.rb', line 32

def pipelined
  if $openc3_redis_cluster
    yield # TODO: Update keys to support pipelining in cluster
  else
    with do |redis|
      redis.pipelined do |pipeline|
        Thread.current[:pipeline] = pipeline
        begin
          yield
        ensure
          Thread.current[:pipeline] = nil
        end
      end
    end
  end
end

#with(**options, &block) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/openc3/utilities/store_autoload.rb', line 49

def with(**options, &block)
  pipeline = Thread.current[:pipeline]
  if pipeline
    yield pipeline
  else
    super(**options, &block)
  end
end