Class: MergeRequests::ProcessAutoMergeFromEventWorker

Inherits:
Object
  • Object
show all
Includes:
Gitlab::EventStore::Subscriber
Defined in:
app/workers/merge_requests/process_auto_merge_from_event_worker.rb

Instance Method Summary collapse

Methods included from Gitlab::EventStore::Subscriber

#perform

Instance Method Details

#handle_event(event) ⇒ Object

The difference with this worker and AutoMergeProcessWorker is that this will handle the execution from the event store code



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/workers/merge_requests/process_auto_merge_from_event_worker.rb', line 13

def handle_event(event)
  merge_request_id = event.data[:merge_request_id]
  merge_request = MergeRequest.find_by_id(merge_request_id)

  unless merge_request
    logger.info(structured_payload(message: 'Merge request not found.', merge_request_id: merge_request_id))
    return
  end

  AutoMergeService.new(merge_request.project, merge_request.merge_user)
                  .process(merge_request)
end