Class: Wurk::Client::Buffered::Origin
- Inherits:
-
Struct
- Object
- Struct
- Wurk::Client::Buffered::Origin
- Defined in:
- lib/wurk/client/buffered.rb
Overview
Where a buffered payload has to be replayed. What must NOT be captured
is a pool object the config hands out: reset_redis_pools! — every
fork, every embedded teardown — disconnects it and drops it for a
lazily rebuilt one, and ConnectionPool#shutdown is terminal, so a
pinned instance replays into dead sockets for the rest of the process's
life. For such a pool the config (a Configuration or a Capsule, which
survives the rebuild) is kept and asked again at replay time. A pool
the config does not own — Client.new(pool:), Client.via(pool) — is
a second Redis nothing else can produce, so that one stays pinned,
stale or not: replaying it anywhere else writes to the wrong server.
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#pool ⇒ Object
Returns the value of attribute pool.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config
81 82 83 |
# File 'lib/wurk/client/buffered.rb', line 81 def config @config end |
#pool ⇒ Object
Returns the value of attribute pool
81 82 83 |
# File 'lib/wurk/client/buffered.rb', line 81 def pool @pool end |
Class Method Details
.for(client) ⇒ Object
82 83 84 85 86 87 |
# File 'lib/wurk/client/buffered.rb', line 82 def self.for(client) pool = client.send(:pool) config = client.instance_variable_get(:@config) owned = config.respond_to?(:redis_pool) && config.redis_pool.equal?(pool) owned ? new(config, nil) : new(nil, pool) end |
Instance Method Details
#resolve ⇒ Object
89 90 91 |
# File 'lib/wurk/client/buffered.rb', line 89 def resolve config ? config.redis_pool : pool end |