Sha256: ce52180445344b0a5beb9ed96b0722940becc1a2f85ee2a7eef9e5033f11d705

Contents?: true

Size: 448 Bytes

Versions: 1

Compression:

Stored size: 448 Bytes

Contents

module Sidetiq
  class Middleware
    def initialize
      @clock = Sidetiq::Clock.instance
    end

    def call(*args)
      # Restart the clock if the thread died.
      if !@clock.ticking?
        Sidekiq.logger.warn "Sidetiq::Clock thread died. Restarting..."
        @clock.start!
      end
      yield
    end
  end
end

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add Sidetiq::Middleware
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidetiq-0.2.0 lib/sidetiq/middleware.rb