Module: Wurk::RedisConnection

Defined in:
lib/wurk/redis_connection.rb

Overview

Sidekiq-compatible pool constructor. ‘Sidekiq::RedisConnection.create(…)` is the documented way to build a standalone Redis pool (spec §26) — it’s the default pool for ‘Sidekiq::Deploy` (§23) and the constructor for per-shard pools in multi-shard web mounts (Pro §10.2). Returns a `Wurk::RedisPool` (connection_pool-backed, redis-client adapter), which is `.with`-compatible with everything that expects a Sidekiq pool.

Accepts Sidekiq’s option keys (‘url`, `size`, `pool_timeout`, `name`), string- or symbol-keyed. Anything omitted falls back to RedisPool’s defaults (URL = ENV or redis://localhost:6379/0).

Constant Summary collapse

DEFAULT_POOL_SIZE =

Housekeeping/standalone default; per-capsule pools size to concurrency.

10

Class Method Summary collapse

Class Method Details

.create(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/wurk/redis_connection.rb', line 20

def self.create(options = {})
  opts = options.transform_keys(&:to_sym)
  RedisPool.new(
    size: opts[:size] || DEFAULT_POOL_SIZE,
    url: opts[:url] || RedisPool::DEFAULT_URL,
    timeout: opts[:pool_timeout] || RedisPool::DEFAULT_TIMEOUT,
    name: opts[:name] || RedisPool::DEFAULT_NAME
  )
end