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
old-commit-hash: 12165c8865d8534e133af483cd15d7dfb3a0579a
This commit is contained in:
Devin Leamy
2021-10-20 10:16:05 -04:00
committed by GitHub
parent 23806c01fe
commit 5b5269cb06
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -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
+4
View File
@@ -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()