Module: Sidekiq::LimitFetch::Redis
- Extended by:
- Redis
- Included in:
- Sidekiq::LimitFetch, Global::Monitor, Global::Semaphore, Redis
- Defined in:
- lib/sidekiq/limit_fetch/redis.rb
Instance Method Summary collapse
- #determine_namespace ⇒ Object
-
#nonblocking_redis ⇒ Object
prevent blocking of fetcher more bullet-proof and faster (O_O) than using Celluloid::IO.
- #redis ⇒ Object
Instance Method Details
#determine_namespace ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/sidekiq/limit_fetch/redis.rb', line 23 def determine_namespace redis do |it| if it.respond_to?(:namespace) and it.namespace it.namespace + ':' end end end |
#nonblocking_redis ⇒ Object
prevent blocking of fetcher more bullet-proof and faster (O_O) than using Celluloid::IO
github.com/brainopia/sidekiq-limit_fetch/issues/41 explanation of why Future#value is beneficial here
10 11 12 13 14 15 16 17 |
# File 'lib/sidekiq/limit_fetch/redis.rb', line 10 def nonblocking_redis redis do |redis| begin Celluloid::Future.new { yield redis }.value end end rescue Celluloid::Task::TerminatedError end |
#redis ⇒ Object
19 20 21 |
# File 'lib/sidekiq/limit_fetch/redis.rb', line 19 def redis Sidekiq.redis {|it| yield it } end |