Sha256: 0edf7ddfe9c37a880d6f1e9e15ca11dc00bd56d6953ed45802817eb23cdbc3af

Contents?: true

Size: 757 Bytes

Versions: 4

Compression:

Stored size: 757 Bytes

Contents

require 'routemaster/client/connection'

module Routemaster
  module Client
    module Backends
      class Sidekiq
        class Worker
          include ::Sidekiq::Worker

          def perform(*args)
            # Sidekiq does not have transparent argument serialization.
            # This extracts the options so they can be passed on properly.
            options = args.last.kind_of?(Hash) ? _symbolize_keys(args.pop) : {}
            Routemaster::Client::Connection.send_event(*args, **options)
          end

          private 

          def _symbolize_keys(h)
            {}.tap do |result|
              h.each do |k,v|
                result[k.to_sym] = v
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
routemaster-client-3.2.3 routemaster/client/backends/sidekiq/worker.rb
routemaster-client-3.2.0 routemaster/client/backends/sidekiq/worker.rb
routemaster-client-3.1.2 routemaster/client/backends/sidekiq/worker.rb
routemaster-client-3.1.1 routemaster/client/backends/sidekiq/worker.rb