Class: Shikibu::Integrations::Sidekiq::TimerWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
lib/shikibu/integrations/sidekiq.rb

Overview

Worker for processing expired timers

Instance Method Summary collapse

Instance Method Details

#perform(instance_id, timer_id) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/shikibu/integrations/sidekiq.rb', line 69

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

  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 }
  )

  storage.remove_timer(instance_id: instance_id, timer_id: timer_id)
  storage.update_instance_status(instance_id, Status::RUNNING)

  ResumeWorker.perform_async(instance_id)
end