From e6aa22dbbb1aec03ba2896f5ca2d85353dbda964 Mon Sep 17 00:00:00 2001 From: gmega Date: Mon, 9 Dec 2024 10:59:09 -0300 Subject: [PATCH] fix log mangling, make event queue 10x bigger to avoid dropping logs --- deluge/core/alertmanager.py | 2 +- deluge/core/metrics.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/deluge/core/alertmanager.py b/deluge/core/alertmanager.py index c5f7b7040..d73b8f167 100644 --- a/deluge/core/alertmanager.py +++ b/deluge/core/alertmanager.py @@ -41,7 +41,7 @@ class AlertManager(component.Component): self.session = component.get('Core').session # Increase the alert queue size so that alerts don't get lost. - self.alert_queue_size = 10000 + self.alert_queue_size = 1000000 self.set_alert_queue_size(self.alert_queue_size) alert_mask = ( diff --git a/deluge/core/metrics.py b/deluge/core/metrics.py index 04b2c9b5d..0ed099656 100644 --- a/deluge/core/metrics.py +++ b/deluge/core/metrics.py @@ -27,6 +27,7 @@ class Metrics: fieldnames=['metric', 'timestamp', 'labels', 'value'], ) self.log_writer.writeheader() + self._flush_to_log() core.session.post_dht_stats() def handle_alert(self, alert): @@ -57,7 +58,9 @@ class Metrics: 'value': alert.piece_index, }) ) + self._flush_to_log() + def _flush_to_log(self): logger.info(self._buffer.getvalue()) self._buffer.truncate(0) self._buffer.seek(0)