Class: CommandTower::Messaging::Handoff::Recovery

Inherits:
Object
  • Object
show all
Defined in:
app/services/command_tower/messaging/handoff/recovery.rb

Constant Summary collapse

GRACE_WINDOW =
1.minute

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(grace_window: GRACE_WINDOW) ⇒ Recovery

Returns a new instance of Recovery.



13
14
15
# File 'app/services/command_tower/messaging/handoff/recovery.rb', line 13

def initialize(grace_window: GRACE_WINDOW)
  @grace_window = grace_window
end

Class Method Details

.call(grace_window: GRACE_WINDOW) ⇒ Object



9
10
11
# File 'app/services/command_tower/messaging/handoff/recovery.rb', line 9

def self.call(grace_window: GRACE_WINDOW)
  new(grace_window:).call
end

Instance Method Details

#callObject



17
18
19
20
21
22
# File 'app/services/command_tower/messaging/handoff/recovery.rb', line 17

def call
  Messaging::Communication.needing_handoff_recovery(grace_before: @grace_window.ago).find_each do |communication|
    Messaging::HandoffJob.perform_later(communication.id)
    OperationLogger.recovered(communication:)
  end
end