mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
Match the cleanup line regardless of casing so it stays filtered if a future RQ release changes the message capitalization. Generated-By: PostHog Code Task-Id: 4b52504d-3f92-4114-b4aa-887a4e6a50f9
26 lines
890 B
Python
26 lines
890 B
Python
import logging
|
|
from typing import Any
|
|
|
|
from rq import Worker
|
|
|
|
|
|
class _DropRegistryCleanupFilter(logging.Filter):
|
|
"""Drops RQ's periodic "cleaning registries for queue" INFO line.
|
|
|
|
The maintenance sweep still runs (crash recovery for orphaned jobs, TTL
|
|
reaping, stale worker pruning); only its log record is suppressed so it
|
|
does not flood logs on every maintenance interval.
|
|
"""
|
|
|
|
def filter(self, record: logging.LogRecord) -> bool:
|
|
return "cleaning registries for queue" not in record.getMessage().lower()
|
|
|
|
|
|
class RomMWorker(Worker):
|
|
"""RQ worker that silences the noisy registry-cleanup log line."""
|
|
|
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
super().__init__(*args, **kwargs)
|
|
if not any(isinstance(f, _DropRegistryCleanupFilter) for f in self.log.filters):
|
|
self.log.addFilter(_DropRegistryCleanupFilter())
|