Class: Shikibu::Integrations::ActiveJob::TimerJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/shikibu/integrations/active_job.rb

Overview

Job for processing expired timers

Instance Method Summary collapse

Instance Method Details

#perform(instance_id, timer_id) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/shikibu/integrations/active_job.rb', line 72

def perform(instance_id, timer_id)
  storage = Shikibu.app.storage

  # Record timer expiration
  storage.append_history(
    instance_id: instance_id,
    activity_id: timer_id,
    event_type: EventType::TIMER_EXPIRED,
    event_data: { timer_id: timer_id, expired_at: Time.now.iso8601 }
  )

  # Remove timer subscription
  storage.remove_timer(instance_id: instance_id, timer_id: timer_id)

  # Resume workflow
  Shikibu.app.resume_workflow(instance_id)
end