Sha256: 79890c196afc691ef9568ccf015bd058ba13f9e086bc472ebf626fd2ea5683ce

Contents?: true

Size: 601 Bytes

Versions: 13

Compression:

Stored size: 601 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) || nil
      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

13 entries across 13 versions & 1 rubygems

Version Path
sidekiq_publisher-2.1.1 lib/sidekiq_publisher/client.rb
sidekiq_publisher-2.1.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-2.0.1 lib/sidekiq_publisher/client.rb
sidekiq_publisher-2.0.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-2.0.0.rc0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.8.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.8.0.rc0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.7.1 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.7.0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.7.0.rc1 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.7.0.rc0 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.6.4 lib/sidekiq_publisher/client.rb
sidekiq_publisher-1.6.3 lib/sidekiq_publisher/client.rb