Class: PatientHttp::Sidekiq::DirectTaskHandler
- Inherits:
-
TaskHandler
- Object
- TaskHandler
- TaskHandler
- PatientHttp::Sidekiq::DirectTaskHandler
- Defined in:
- lib/patient_http/sidekiq/direct_task_handler.rb
Overview
TaskHandler for requests executed directly on the local processor without an enqueued Sidekiq job. Requests with scoped Sidekiq options always go through the queue, so the handler only deals with the default RequestWorker options.
Retry enqueues a normal RequestWorker job with the original arguments, so the fail-back behavior matches the enqueued path. The sidekiq_job hash is a minimal job record kept for the crash-recovery registry; it has no jid because no Sidekiq job exists until the request is re-enqueued, so job_id returns nil.
Instance Attribute Summary
Attributes inherited from TaskHandler
Instance Method Summary collapse
-
#initialize(args) ⇒ DirectTaskHandler
constructor
A new instance of DirectTaskHandler.
-
#retry ⇒ String
Re-enqueue the request as a normal RequestWorker job.
Methods inherited from TaskHandler
#job_id, #on_complete, #on_error, #worker_class
Constructor Details
#initialize(args) ⇒ DirectTaskHandler
Returns a new instance of DirectTaskHandler.
17 18 19 20 |
# File 'lib/patient_http/sidekiq/direct_task_handler.rb', line 17 def initialize(args) @args = args super(minimal_job_record) end |
Instance Method Details
#retry ⇒ String
Re-enqueue the request as a normal RequestWorker job.
25 26 27 |
# File 'lib/patient_http/sidekiq/direct_task_handler.rb', line 25 def retry RequestWorker.perform_async(*@args) end |