Class: Gitlab::HealthChecks::MasterCheck

Inherits:
Object
  • Object
show all
Extended by:
SimpleAbstractCheck, Utils::Override
Defined in:
lib/gitlab/health_checks/master_check.rb

Overview

This check is registered on master, and validated by worker

Class Method Summary collapse

Methods included from SimpleAbstractCheck

metrics, readiness

Methods included from BaseAbstractCheck

#available?, #human_name, #metrics, #name, #readiness

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/gitlab/health_checks/master_check.rb', line 14

def available?
  Gitlab::Runtime.puma_in_clustered_mode?
end

.finish_masterObject



27
28
29
30
31
32
# File 'lib/gitlab/health_checks/master_check.rb', line 27

def finish_master
  return unless available?

  close_read
  close_write
end

.register_masterObject



18
19
20
21
22
23
24
25
# File 'lib/gitlab/health_checks/master_check.rb', line 18

def register_master
  return unless available?

  # when we fork, we pass the read pipe to child
  # child can then react on whether the other end
  # of pipe is still available
  @pipe_read, @pipe_write = IO.pipe
end

.register_workerObject



34
35
36
37
38
39
# File 'lib/gitlab/health_checks/master_check.rb', line 34

def register_worker
  return unless available?

  # fork needs to close the pipe
  close_write
end