Sha256: 9415bc0e57f385c5cdd0e011027b6655ef8a46a3ad44dd04c52e66c94f29b2d9

Contents?: true

Size: 594 Bytes

Versions: 19

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

require "sidekiq"

module SidekiqPublisher
  class Client < Sidekiq::Client
    def bulk_push(items)
      payloads = items.map do |item|
        normed = normalize_item(item)
        process_single(item["class"], normed)
      end.compact

      pushed = 0
      with_connection do |conn|
        conn.multi do
          payloads.each do |payload|
            atomic_push(conn, [payload])
            pushed += 1
          end
        end
      end

      pushed
    end

    private

    def with_connection(&blk)
      @redis_pool.with(&blk)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sidekiq_publisher-1.6.2 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.6.1 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.6.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.6.0.pre0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.5.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.4.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.4.0.rc0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.3.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.2.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.1.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.0.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.3.3 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.3.2 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.3.1 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.3.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.2.1 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.2.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.1.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-0.1.0.rc0 lib/sidekiq_publisher/client.rb