Sha256: 1397bb47cca38688706d1f60596bf7642af765660facc7a26b69500a728e4fda

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

module Sidekiq
  module Restart
    class Command

      def initialize sidekiq
        @sidekiq = sidekiq
      end

      def run id
        @sidekiq.redis do |conn|
          payload = conn.get("worker:#{id}")
          if payload
            msg = @sidekiq.load_json(payload)['payload']
            Sidekiq::Client.push msg

            # cleanup redis details about the worker
            conn.srem("workers", id)
            conn.del("worker:#{id}")
            conn.del("worker:#{id}:started")
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-restart-0.0.1 lib/sidekiq/restart/command.rb