Class: IrkerWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker
Defined in:
app/workers/irker_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY

Constants included from WorkerAttributes

WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(project_id, channels, colors, push_data, settings) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/workers/irker_worker.rb', line 11

def perform(project_id, channels, colors, push_data, settings)
  # Establish connection to irker server
  return false unless start_connection(settings['server_host'],
                                       settings['server_port'])

  @project = Project.find(project_id)
  @colors = colors
  @channels = channels

  @repo_path = @project.full_path
  @repo_name = push_data['repository']['name']
  @committer = push_data['user_name']
  @branch = push_data['ref'].gsub(%r'refs/[^/]*/', '')

  if @colors
    @repo_name = "\x0304#{@repo_name}\x0f"
    @branch = "\x0305#{@branch}\x0f"
  end

  # First messages are for branch creation/deletion
  send_branch_updates(push_data)

  # Next messages are for commits
  send_commits(push_data)

  close_connection
  true
end