Class: Textus::Handlers::Maintenance::JobsAction
- Inherits:
-
Object
- Object
- Textus::Handlers::Maintenance::JobsAction
- Defined in:
- lib/textus/handlers/maintenance/jobs_action.rb
Instance Method Summary collapse
- #call(command, _call) ⇒ Object
-
#initialize(job_store:) ⇒ JobsAction
constructor
A new instance of JobsAction.
Constructor Details
#initialize(job_store:) ⇒ JobsAction
Returns a new instance of JobsAction.
5 6 7 |
# File 'lib/textus/handlers/maintenance/jobs_action.rb', line 5 def initialize(job_store:) @job_store = job_store end |
Instance Method Details
#call(command, _call) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/textus/handlers/maintenance/jobs_action.rb', line 9 def call(command, _call) queue = Textus::Store::Jobs::Queue.new(store: @job_store) case command.action when "retry" then queue.retry_failed(command.job_id) when "purge" then queue.purge(command.state) end Value::Result.success("protocol" => Textus::PROTOCOL, "ok" => true, "state" => command.state, "jobs" => queue.list(command.state)) end |