Class: Ci::Workloads::UpdateWorkloadStatusEventWorker

Inherits:
Object
  • Object
show all
Includes:
Gitlab::EventStore::Subscriber
Defined in:
app/workers/ci/workloads/update_workload_status_event_worker.rb

Overview

rubocop: disable Scalability/IdempotentWorker – EventStore::Subscriber includes idempotent

Instance Method Summary collapse

Methods included from Gitlab::EventStore::Subscriber

#handle_event_in, #perform

Instance Method Details

#handle_event(event) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'app/workers/ci/workloads/update_workload_status_event_worker.rb', line 12

def handle_event(event)
  pipeline = Ci::Pipeline.find_by_id(event.data[:pipeline_id])
  return unless pipeline

  workload = pipeline.workload
  return unless workload

  event.data[:status].to_sym == :success ? workload.finish! : workload.drop!
end