From 12165c8865d8534e133af483cd15d7dfb3a0579a Mon Sep 17 00:00:00 2001 From: Devin Leamy Date: Wed, 20 Oct 2021 10:16:05 -0400 Subject: [PATCH] athena: Do not show canceled upload items in listUploadQueue (#22627) * do not show canceled upload items in listUploadQueue * return item._asdict() * athena: updated test for listUploadQueue --- selfdrive/athena/athenad.py | 2 +- selfdrive/athena/tests/test_athenad.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/selfdrive/athena/athenad.py b/selfdrive/athena/athenad.py index 4c656756b4..2265793790 100755 --- a/selfdrive/athena/athenad.py +++ b/selfdrive/athena/athenad.py @@ -253,7 +253,7 @@ def uploadFileToUrl(fn, url, headers): @dispatcher.add_method def listUploadQueue(): items = list(upload_queue.queue) + list(cur_upload_items.values()) - return [i._asdict() for i in items if i is not None] + return [i._asdict() for i in items if i.id not in cancelled_uploads and i is not None] @dispatcher.add_method diff --git a/selfdrive/athena/tests/test_athenad.py b/selfdrive/athena/tests/test_athenad.py index 51b7952e01..5bf34d1bc7 100755 --- a/selfdrive/athena/tests/test_athenad.py +++ b/selfdrive/athena/tests/test_athenad.py @@ -245,6 +245,10 @@ class TestAthenadMethods(unittest.TestCase): self.assertDictEqual(items[0], item._asdict()) self.assertFalse(items[0]['current']) + athenad.cancelled_uploads.add(item.id) + items = dispatcher["listUploadQueue"]() + self.assertEqual(len(items), 0) + @mock.patch('selfdrive.athena.athenad.create_connection') def test_startLocalProxy(self, mock_create_connection): end_event = threading.Event()