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: 82ad615ce254b6d313e340fc77fab456d0b5193a (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

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

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