Class: SafeRequestTimeout::SidekiqMiddleware

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::ServerMiddleware
Defined in:
lib/safe_request_timeout/sidekiq_middleware.rb

Overview

Sidekiq server middleware that wraps job execution with a timeout. The timeout is set in a job’s “safe_request_timeout” option.

Instance Method Summary collapse

Instance Method Details

#call(job_instance, job_payload, queue) ⇒ Object



11
12
13
14
15
# File 'lib/safe_request_timeout/sidekiq_middleware.rb', line 11

def call(job_instance, job_payload, queue)
  SafeRequestTimeout.timeout(job_payload["safe_request_timeout"]) do
    yield
  end
end