mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
Call mark_process_dead on worker pid if prometheus_client is installed (#212)
This commit is contained in:
@@ -21,7 +21,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
# Local
|
||||
from django_q.brokers import Broker, get_broker
|
||||
from django_q.conf import Conf, get_ppid, logger, psutil, setproctitle
|
||||
from django_q.conf import Conf, get_ppid, logger, psutil, setproctitle, prometheus_multiprocess
|
||||
from django_q.humanhash import humanize
|
||||
from django_q.monitor import monitor
|
||||
from django_q.pusher import pusher
|
||||
@@ -223,6 +223,8 @@ class Sentinel:
|
||||
% {"name": process.name}
|
||||
)
|
||||
else:
|
||||
if prometheus_multiprocess:
|
||||
prometheus_multiprocess.mark_process_dead(process.pid)
|
||||
self.pool.remove(process)
|
||||
self.spawn_worker()
|
||||
if process.timer.value == 0:
|
||||
|
||||
@@ -38,6 +38,11 @@ try:
|
||||
except ModuleNotFoundError:
|
||||
setproctitle = None
|
||||
|
||||
try:
|
||||
from prometheus_client import multiprocess as prometheus_multiprocess
|
||||
except ModuleNotFoundError:
|
||||
prometheus_multiprocess = None
|
||||
|
||||
|
||||
class Conf:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user