From 41c5b11ac5ebb4e17ce18130a4f2fc26b9232eb7 Mon Sep 17 00:00:00 2001 From: cortadocodes Date: Tue, 6 Feb 2024 14:52:54 +0000 Subject: [PATCH] ENH: Warn about messages with duplicate message numbers --- octue/cloud/pub_sub/message_handler.py | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/octue/cloud/pub_sub/message_handler.py b/octue/cloud/pub_sub/message_handler.py index 8385539d7..296d35e47 100644 --- a/octue/cloud/pub_sub/message_handler.py +++ b/octue/cloud/pub_sub/message_handler.py @@ -273,6 +273,15 @@ def _extract_and_enqueue_event(self, message): self._child_sdk_version = attributes["version"] message_number = attributes["message_number"] + + if message_number in self.waiting_messages: + logger.warning( + "%r: Message with duplicate message number %d received for question %s - overwriting original message.", + self.receiving_service, + message_number, + self.question_uuid, + ) + self.waiting_messages[message_number] = event def _attempt_to_handle_waiting_messages(self): diff --git a/pyproject.toml b/pyproject.toml index 24c706077..0aed7fb40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "octue" -version = "0.52.0" +version = "0.52.1" description = "A package providing template applications for data services, and a python SDK to the Octue API." readme = "README.md" authors = ["Marcus Lugg ", "Thomas Clark "]