Module: Sidekiq::Routing::Store
- Defined in:
- lib/sidekiq/routing/store.rb
Overview
Source of truth for manual route state: a single Redis hash in Sidekiq’s Redis, field = job class name, value = JSON routed_at. These reads are uncached (used by the operator API and Web tab); the middleware hot path uses Sidekiq::Routing.route_for instead.
Constant Summary collapse
- HASH_KEY =
"sidekiq:routing:routes"
Class Method Summary collapse
-
.all ⇒ Object
-> { “ClassName” => “mode”=>…, … }.
- .delete(name) ⇒ Object
-
.fetch(name) ⇒ Object
-> “mode”=>… or nil.
- .set(name, mode:) ⇒ Object
Class Method Details
.all ⇒ Object
-> { “ClassName” => “mode”=>…, … }
34 35 36 37 |
# File 'lib/sidekiq/routing/store.rb', line 34 def all Sidekiq.redis { |conn| conn.hgetall(HASH_KEY) } .transform_values { |raw| JSON.parse(raw) } end |
.delete(name) ⇒ Object
23 24 25 |
# File 'lib/sidekiq/routing/store.rb', line 23 def delete(name) Sidekiq.redis { |conn| conn.hdel(HASH_KEY, name) } end |