Class: Textus::Action::Jobs

Inherits:
Base
  • Object
show all
Defined in:
lib/textus/action/jobs.rb

Class Method Summary collapse

Methods inherited from Base

inherited, proposal_from

Methods included from Contract::DSL

#arg, #cli, #cli_stdin, #contract, #contract?, #summary, #surfaces, #verb, #view

Class Method Details

.call(container:, call:, state: "ready", action: nil, job_id: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/textus/action/jobs.rb', line 14

def self.call(container:, call:, state: "ready", action: nil, job_id: nil) # rubocop:disable Lint/UnusedMethodArgument
  queue = Textus::Store::Jobs::Queue.new(store: container.job_store)
  case action
  when "retry"
    queue.retry_failed(job_id)
  when "purge"
    queue.purge(state)
  end

  Success({ "protocol" => Textus::PROTOCOL, "ok" => true, "state" => state, "jobs" => queue.list(state) })
end