Class: Wurk::RedisClientAdapter::CompatClient

Inherits:
Object
  • Object
show all
Defined in:
lib/wurk/redis_client_adapter.rb

Constant Summary collapse

DISPATCH_METHODS =

Dispatch methods that put commands on the wire and wait for the reply. SCAN and friends are left out on purpose: they are pure reads, so re-running one applies nothing and cannot make a replay unsafe.

%i[call call_v call_once call_once_v
blocking_call blocking_call_v pipelined multi].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CompatClient

Returns a new instance of CompatClient.



88
89
90
91
# File 'lib/wurk/redis_client_adapter.rb', line 88

def initialize(client)
  super
  @round_trips = 0
end

Instance Attribute Details

#round_tripsObject (readonly)

Round trips this connection has completed, monotonic for its whole life.

Wurk::RedisPool replays a failed block only while it can prove nothing in it applied, and a connect-phase error proves that for the command that raised — never for the ones before it. redis-client re-dials a dropped socket mid-block, so CannotConnectError surfaces on the second pipeline of a block whose first one already landed. The pool snapshots this counter around the block and refuses the replay once it has moved.



86
87
88
# File 'lib/wurk/redis_client_adapter.rb', line 86

def round_trips
  @round_trips
end

Instance Method Details

#configObject



93
94
95
# File 'lib/wurk/redis_client_adapter.rb', line 93

def config
  @client.config
end