Class: Sidekiq::RedisClientAdapter::CompatClient
- Inherits:
-
Object
- Object
- Sidekiq::RedisClientAdapter::CompatClient
- Defined in:
- lib/sidekiq/redis_client_adapter.rb
Instance Method Summary collapse
- #_client ⇒ Object
- #connection ⇒ Object
- #disconnect! ⇒ Object
- #message {|nil, @queue.pop| ... } ⇒ Object
- #redis ⇒ Object
-
#subscribe(chan) ⇒ Object
NB: this method does not return.
Instance Method Details
#_client ⇒ Object
75 76 77 |
# File 'lib/sidekiq/redis_client_adapter.rb', line 75 def _client @client end |
#connection ⇒ Object
67 68 69 |
# File 'lib/sidekiq/redis_client_adapter.rb', line 67 def connection {id: @client.id} end |
#disconnect! ⇒ Object
63 64 65 |
# File 'lib/sidekiq/redis_client_adapter.rb', line 63 def disconnect! @client.close end |
#message {|nil, @queue.pop| ... } ⇒ Object
79 80 81 |
# File 'lib/sidekiq/redis_client_adapter.rb', line 79 def yield nil, @queue.pop end |
#redis ⇒ Object
71 72 73 |
# File 'lib/sidekiq/redis_client_adapter.rb', line 71 def redis self end |
#subscribe(chan) ⇒ Object
NB: this method does not return
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/sidekiq/redis_client_adapter.rb', line 84 def subscribe(chan) @queue = ::Queue.new pubsub = @client.pubsub pubsub.call("subscribe", chan) loop do evt = pubsub.next_event next if evt.nil? next unless evt[0] == "message" && evt[1] == chan (_, _, msg) = evt @queue << msg yield self end end |