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

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

return unless Gitlab::Runtime.application?
return unless Gitlab::Utils.to_boolean(ENV['GITLAB_MEMORY_WATCHDOG_ENABLED'])

Gitlab::Cluster::LifecycleEvents.on_worker_start do
  handler =
    if Gitlab::Runtime.puma?
      Gitlab::Memory::Watchdog::PumaHandler.new
    elsif Gitlab::Runtime.sidekiq?
      Gitlab::Memory::Watchdog::TermProcessHandler.new
    else
      Gitlab::Memory::Watchdog::NullHandler.instance
    end

  Gitlab::Memory::Watchdog.new(
    handler: handler, logger: Gitlab::AppLogger
  ).start
end