From 25bd486f8e5413d5401a7b0f5302a47f250b2377 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 06:24:03 +0000 Subject: [PATCH 1/6] Bump vite-plugin-electron from 0.28.0 to 0.28.2 in /gui Bumps [vite-plugin-electron](https://github.com/electron-vite/vite-plugin-electron) from 0.28.0 to 0.28.2. - [Release notes](https://github.com/electron-vite/vite-plugin-electron/releases) - [Changelog](https://github.com/electron-vite/vite-plugin-electron/blob/main/CHANGELOG.md) - [Commits](https://github.com/electron-vite/vite-plugin-electron/compare/v0.28.0...v0.28.2) --- updated-dependencies: - dependency-name: vite-plugin-electron dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- gui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/package.json b/gui/package.json index 525c3e01..1a4f3eb4 100644 --- a/gui/package.json +++ b/gui/package.json @@ -76,7 +76,7 @@ "eslint-plugin-vue": "9.20.1", "typescript": "5.3.3", "vite": "5.1.3", - "vite-plugin-electron": "0.28.0", + "vite-plugin-electron": "0.28.2", "vite-plugin-electron-renderer": "0.14.5", "vitest": "1.2.2", "vue": "3.4.15", From 10be8db7d0a45bccf8855a3cc62cfdf8bbc0bead Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Mon, 19 Feb 2024 08:27:40 +0100 Subject: [PATCH 2/6] improved arq tests which went stuck --- modem/arq_session_iss.py | 1 - tests/test_arq_session.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modem/arq_session_iss.py b/modem/arq_session_iss.py index 68c4e922..9c69522c 100644 --- a/modem/arq_session_iss.py +++ b/modem/arq_session_iss.py @@ -182,7 +182,6 @@ class ARQSessionISS(arq_session.ARQSession): self.states.setARQ(False) self.arq_data_type_handler.failed(self.type_byte, self.data) - return None, None def abort_transmission(self, irs_frame=None): diff --git a/tests/test_arq_session.py b/tests/test_arq_session.py index 961c2262..185e90e3 100644 --- a/tests/test_arq_session.py +++ b/tests/test_arq_session.py @@ -103,7 +103,7 @@ class TestARQSession(unittest.TestCase): def waitForSession(self, q, outbound = False): key = 'arq-transfer-outbound' if outbound else 'arq-transfer-inbound' - while True: + while True and self.channels_running: ev = q.get() if key in ev and ('success' in ev[key] or 'ABORTED' in ev[key]): self.logger.info(f"[{threading.current_thread().name}] {key} session ended.") @@ -125,6 +125,7 @@ class TestARQSession(unittest.TestCase): def waitAndCloseChannels(self): self.waitForSession(self.iss_event_queue, True) + self.channels_running = False self.waitForSession(self.irs_event_queue, False) self.channels_running = False From 35276b01ef53b44a1f77728f242f30c6162ac97c Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Mon, 19 Feb 2024 08:37:16 +0100 Subject: [PATCH 3/6] improved message tests which went stuck --- tests/test_message_protocol.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_message_protocol.py b/tests/test_message_protocol.py index 591daefa..eedf7a00 100644 --- a/tests/test_message_protocol.py +++ b/tests/test_message_protocol.py @@ -108,7 +108,7 @@ class TestMessageProtocol(unittest.TestCase): def waitForSession(self, q, outbound=False): key = 'arq-transfer-outbound' if outbound else 'arq-transfer-inbound' - while True: + while True and self.channels_running: ev = q.get() if key in ev and ('success' in ev[key] or 'ABORTED' in ev[key]): self.logger.info(f"[{threading.current_thread().name}] {key} session ended.") @@ -130,6 +130,7 @@ class TestMessageProtocol(unittest.TestCase): def waitAndCloseChannels(self): self.waitForSession(self.iss_event_queue, True) + self.channels_running = False self.waitForSession(self.irs_event_queue, False) self.channels_running = False From 2c24545e68755e31c56a9a9908b24069546ddc82 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Mon, 19 Feb 2024 10:53:44 +0100 Subject: [PATCH 4/6] possibly fixed repeating message --- modem/message_system_db_messages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modem/message_system_db_messages.py b/modem/message_system_db_messages.py index 255b8ab5..b670dccc 100644 --- a/modem/message_system_db_messages.py +++ b/modem/message_system_db_messages.py @@ -218,7 +218,7 @@ class DatabaseManagerMessages(DatabaseManager): # Query for messages with the specified callsign, 'failed' status, and fewer than 10 attempts messages = session.query(P2PMessage) \ - .filter(P2PMessage.origin_callsign == callsign) \ + .filter(P2PMessage.destination_callsign == callsign) \ .filter(P2PMessage.status_id == failed_status.id) \ .filter(P2PMessage.attempt < 10) \ .all() From 30de19f729bbc3676b3fb2e099f0668fde14253b Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Mon, 19 Feb 2024 10:59:53 +0100 Subject: [PATCH 5/6] possibly fixed repeating message --- modem/message_system_db_messages.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/modem/message_system_db_messages.py b/modem/message_system_db_messages.py index b670dccc..914bfcaa 100644 --- a/modem/message_system_db_messages.py +++ b/modem/message_system_db_messages.py @@ -171,21 +171,27 @@ class DatabaseManagerMessages(DatabaseManager): finally: session.remove() - def increment_message_attempts(self, message_id): - session = self.get_thread_scoped_session() + def increment_message_attempts(self, message_id, session=None): + own_session = False + if not session: + session = self.get_thread_scoped_session() + own_session = True try: message = session.query(P2PMessage).filter_by(id=message_id).first() if message: message.attempt += 1 - session.commit() + if own_session: + session.commit() self.log(f"Incremented attempt count for message {message_id}") else: self.log(f"Message with ID {message_id} not found") except Exception as e: - session.rollback() + if own_session: + session.rollback() self.log(f"An error occurred while incrementing attempts for message {message_id}: {e}") finally: - session.remove() + if own_session: + session.remove() def mark_message_as_read(self, message_id): session = self.get_thread_scoped_session() @@ -227,7 +233,7 @@ class DatabaseManagerMessages(DatabaseManager): # Update each message's status to 'queued' for message in messages: # Increment attempt count using the existing function - self.increment_message_attempts(message.id) + self.increment_message_attempts(message.id, session) message.status_id = queued_status.id self.log(f"Set message {message.id} to queued and incremented attempt") From b7563040eff78e6f9eb225852d84a51585fd3abc Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Mon, 19 Feb 2024 11:06:15 +0100 Subject: [PATCH 6/6] only retry first result --- modem/message_system_db_messages.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/modem/message_system_db_messages.py b/modem/message_system_db_messages.py index 914bfcaa..639ac92f 100644 --- a/modem/message_system_db_messages.py +++ b/modem/message_system_db_messages.py @@ -223,23 +223,21 @@ class DatabaseManagerMessages(DatabaseManager): return # Query for messages with the specified callsign, 'failed' status, and fewer than 10 attempts - messages = session.query(P2PMessage) \ + message = session.query(P2PMessage) \ .filter(P2PMessage.destination_callsign == callsign) \ .filter(P2PMessage.status_id == failed_status.id) \ .filter(P2PMessage.attempt < 10) \ - .all() + .first() - if messages: - # Update each message's status to 'queued' - for message in messages: - # Increment attempt count using the existing function - self.increment_message_attempts(message.id, session) + if message: + # Increment attempt count using the existing function + self.increment_message_attempts(message.id, session) - message.status_id = queued_status.id - self.log(f"Set message {message.id} to queued and incremented attempt") + message.status_id = queued_status.id + self.log(f"Set message {message.id} to queued and incremented attempt") session.commit() - return {'status': 'success', 'message': f'{len(messages)} message(s) set to queued'} + return {'status': 'success', 'message': f'{len(message)} message(s) set to queued'} else: return {'status': 'failure', 'message': 'No eligible messages found'} except Exception as e: