From bd6cdc5409f4d0cc5edc384527ca995c5c6b76d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 20 Jul 2018 09:20:42 +0200 Subject: [PATCH] Fix stored messages growing infinitely on reloads --- lib/tfw/networking/server/tfw_server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tfw/networking/server/tfw_server.py b/lib/tfw/networking/server/tfw_server.py index 41bb7aa..f0471ef 100644 --- a/lib/tfw/networking/server/tfw_server.py +++ b/lib/tfw/networking/server/tfw_server.py @@ -47,6 +47,7 @@ class TFWServer: def handle_recover(self, message): if message['key'] == 'recover': self._frontend_messages.replay_messages(self._uplink_connector) + self._frontend_messages.clear() def save_frontend_messages(self, message): self._frontend_messages.save_message(message) @@ -70,6 +71,9 @@ class MessageStorage(ABC): def transform_message(self, message): # pylint: disable=no-self-use yield message + def clear(self): + self.saved_messages.clear() + class FrontendMessageStorage(MessageStorage): def filter_message(self, message):