File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import logging
2+ from typing import Any
3+
4+ from rq import Worker
5+
6+
7+ class _DropRegistryCleanupFilter (logging .Filter ):
8+ """Drops RQ's periodic "cleaning registries for queue" INFO line.
9+
10+ The maintenance sweep still runs (crash recovery for orphaned jobs, TTL
11+ reaping, stale worker pruning); only its log record is suppressed so it
12+ does not flood logs on every maintenance interval.
13+ """
14+
15+ def filter (self , record : logging .LogRecord ) -> bool :
16+ return "cleaning registries for queue" not in record .getMessage ()
17+
18+
19+ class RomMWorker (Worker ):
20+ """RQ worker that silences the noisy registry-cleanup log line."""
21+
22+ def __init__ (self , * args : Any , ** kwargs : Any ) -> None :
23+ super ().__init__ (* args , ** kwargs )
24+ if not any (isinstance (f , _DropRegistryCleanupFilter ) for f in self .log .filters ):
25+ self .log .addFilter (_DropRegistryCleanupFilter ())
Original file line number Diff line number Diff line change @@ -233,8 +233,12 @@ start_bin_rq_worker() {
233233 fi
234234
235235 # Set PYTHONPATH so RQ can find the tasks module
236+ # Sweep registries hourly instead of every ~10 min, using a worker class that
237+ # drops the noisy per-sweep "cleaning registries for queue" log line.
236238 PYTHONPATH=" /backend:${PYTHONPATH-} " rq worker \
237239 --path /backend \
240+ --worker-class handler.rq_worker.RomMWorker \
241+ --maintenance-interval 3600 \
238242 --pid /tmp/rq_worker.pid \
239243 --url " ${redis_url} " \
240244 --results-ttl " ${TASK_RESULT_TTL:- 86400} " \
Original file line number Diff line number Diff line change 6969fi
7070
7171# Set PYTHONPATH so RQ can find the tasks module
72+ # Sweep registries hourly instead of every ~10 min, using a worker class that
73+ # drops the noisy per-sweep "cleaning registries for queue" log line.
7274PYTHONPATH=" /app/backend:${PYTHONPATH-} " rq worker \
7375 --path /app/backend \
76+ --worker-class handler.rq_worker.RomMWorker \
77+ --maintenance-interval 3600 \
7478 --pid /tmp/rq_worker.pid \
7579 --url " ${REDIS_URL} " \
7680 --logging_level " ${LOGLEVEL:- INFO} " \
You can’t perform that action at this time.
0 commit comments