Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sidekiq_cluster.rb « initializers « config - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: baa7495aa2970bf986145bab4809a65df9fe05c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

if ENV['ENABLE_SIDEKIQ_CLUSTER'] && Gitlab.ee?
  Thread.new do
    Thread.current.abort_on_exception = true

    parent = Process.ppid

    loop do
      sleep(5)

      # In cluster mode it's possible that the master process is SIGKILL'd. In
      # this case the parent PID changes and we need to terminate ourselves.
      if Process.ppid != parent
        Process.kill(:TERM, Process.pid)
        break
      end
    end
  end
end