2022-08-13 15:12:31 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
return unless Gitlab::Runtime.application?
|
2023-04-23 21:23:45 +05:30
|
|
|
return unless Gitlab::Utils.to_boolean(ENV['GITLAB_MEMORY_WATCHDOG_ENABLED'], default: true)
|
2022-08-13 15:12:31 +05:30
|
|
|
|
|
|
|
Gitlab::Cluster::LifecycleEvents.on_worker_start do
|
2022-11-25 23:54:43 +05:30
|
|
|
watchdog = Gitlab::Memory::Watchdog.new
|
2023-01-13 00:05:48 +05:30
|
|
|
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)
|
2022-11-25 23:54:43 +05:30
|
|
|
end
|
2022-08-13 15:12:31 +05:30
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
Gitlab::BackgroundTask.new(watchdog).start
|
2022-08-13 15:12:31 +05:30
|
|
|
end
|