Sha256: 39d9568ade8987154673a6219258b2ad59229b23f225b263098f8a837e9c7bc4

Contents?: true

Size: 531 Bytes

Versions: 12

Compression:

Stored size: 531 Bytes

Contents

module Sidekiq::LimitFetch::Redis
  extend self

  # prevent blocking of fetcher
  # more bullet-proof and faster (O_O)
  # than using Celluloid::IO
  def nonblocking_redis
    redis do |redis|
      begin
        Celluloid::Future.new { yield redis }.value
      end
    end
  rescue Celluloid::Task::TerminatedError
  end

  def redis
    Sidekiq.redis {|it| yield it }
  end

  def determine_namespace
    redis do |it|
      if it.respond_to?(:namespace) and it.namespace
        it.namespace + ':'
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sidekiq-limit_fetch-2.2.5 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.2.4 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.2.3 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.2.2 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.2.1 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.2.0 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.1.3 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.1.2 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.1.1 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.1.0 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.0.2 lib/sidekiq/limit_fetch/redis.rb
sidekiq-limit_fetch-2.0.1 lib/sidekiq/limit_fetch/redis.rb