Class: Agent::Lock::CLI::Commands::Resume

Inherits:
Base
  • Object
show all
Defined in:
lib/agent/lock/cli/commands/resume.rb

Overview

Pick up work a reboot or a crash interrupted.

A lock whose holder died is orphaned rather than deleted when it has notes in it. This takes it back, prints what the last session wrote, and makes it a live claim again under the current identity.

Instance Attribute Summary

Attributes inherited from Base

#launcher

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Constructor Details

This class inherits a constructor from Agent::Lock::CLI::Commands::Base

Instance Method Details

#call(scope:, **options) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/agent/lock/cli/commands/resume.rb', line 19

def call(scope:, **options)
  result = manager(options[:dir]).resume(scope)

  if result.status == :not_found
    say("NOTHING TO RESUME #{scope}")
  else
    say("RESUMED #{result.record.scope}  (holder: #{result.record.agent_id})")
    say("")
    say(result.record.intent)
  end

  finish(result)
end