From b35e84e479d5db57c4e6029d74f02596a79b8c0d Mon Sep 17 00:00:00 2001 From: adbenitez Date: Tue, 29 Apr 2025 16:51:10 +0200 Subject: [PATCH] avoid crash on spurious empty file in the pending_notifications dir --- chatmaild/src/chatmaild/notifier.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chatmaild/src/chatmaild/notifier.py b/chatmaild/src/chatmaild/notifier.py index 6a2136fa..60966d05 100644 --- a/chatmaild/src/chatmaild/notifier.py +++ b/chatmaild/src/chatmaild/notifier.py @@ -95,7 +95,12 @@ class Notifier: logging.warning(f"removing spurious queue item: {queue_path!r}") queue_path.unlink() continue - queue_item = PersistentQueueItem.read_from_path(queue_path) + try: + queue_item = PersistentQueueItem.read_from_path(queue_path) + except ValueError: + logging.warning(f"removing spurious queue item: {queue_path!r}") + queue_path.unlink() + continue self.queue_for_retry(queue_item) def queue_for_retry(self, queue_item, retry_num=0):