blob: 27d9bf8b8f857cb4d3554f3afd3218a7a44feba3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# frozen_string_literal: true
return unless Gitlab::Runtime.application?
return unless Gitlab::Utils.to_boolean(ENV['GITLAB_MEMORY_WATCHDOG_ENABLED'], default: true)
Gitlab::Cluster::LifecycleEvents.on_worker_start do
watchdog = Gitlab::Memory::Watchdog.new
if Gitlab::Runtime.puma?
watchdog.configure(&Gitlab::Memory::Watchdog::Configurator.configure_for_puma)
elsif Gitlab::Runtime.sidekiq?
watchdog.configure(&Gitlab::Memory::Watchdog::Configurator.configure_for_sidekiq)
end
Gitlab::BackgroundTask.new(watchdog).start
end
|