Commit 374ffde7 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'mk-untold-daemons-lurking' into 'master'

Name all daemons

Closes #35413

See merge request gitlab-org/gitlab!19477
parents 72a963f0 6e50040b
...@@ -28,6 +28,10 @@ module Gitlab ...@@ -28,6 +28,10 @@ module Gitlab
true true
end end
def thread_name
self.class.name.demodulize.underscore
end
def start def start
return unless enabled? return unless enabled?
...@@ -35,7 +39,10 @@ module Gitlab ...@@ -35,7 +39,10 @@ module Gitlab
break thread if thread? break thread if thread?
if start_working if start_working
@thread = Thread.new { run_thread } @thread = Thread.new do
Thread.current.name = thread_name
run_thread
end
end end
end end
end end
......
...@@ -4,6 +4,7 @@ module Gitlab ...@@ -4,6 +4,7 @@ module Gitlab
module SidekiqDaemon module SidekiqDaemon
class Monitor < Daemon class Monitor < Daemon
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
extend ::Gitlab::Utils::Override
NOTIFICATION_CHANNEL = 'sidekiq:cancel:notifications' NOTIFICATION_CHANNEL = 'sidekiq:cancel:notifications'
CANCEL_DEADLINE = 24.hours.seconds CANCEL_DEADLINE = 24.hours.seconds
...@@ -24,6 +25,11 @@ module Gitlab ...@@ -24,6 +25,11 @@ module Gitlab
@jobs_mutex = Mutex.new @jobs_mutex = Mutex.new
end end
override :thread_name
def thread_name
"job_monitor"
end
def within_job(worker_class, jid, queue) def within_job(worker_class, jid, queue)
jobs_mutex.synchronize do jobs_mutex.synchronize do
jobs[jid] = { worker_class: worker_class, thread: Thread.current, started_at: Gitlab::Metrics::System.monotonic_time } jobs[jid] = { worker_class: worker_class, thread: Thread.current, started_at: Gitlab::Metrics::System.monotonic_time }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment