From 9e97c9ebe900f5726fed6a48287c00ac545dc603 Mon Sep 17 00:00:00 2001 From: ff137 Date: Fri, 30 Aug 2024 17:48:41 +0300 Subject: [PATCH] :fire: remove unnecessary record sorts (now that askar sorts by id == sorting by created_at) Signed-off-by: ff137 --- aries_cloudagent/multitenant/admin/routes.py | 1 - .../protocols/connections/v1_0/routes.py | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/aries_cloudagent/multitenant/admin/routes.py b/aries_cloudagent/multitenant/admin/routes.py index f3a33bc88d..b7608d999c 100644 --- a/aries_cloudagent/multitenant/admin/routes.py +++ b/aries_cloudagent/multitenant/admin/routes.py @@ -398,7 +398,6 @@ async def wallets_list(request: web.BaseRequest): descending=descending, ) results = [format_wallet_record(record) for record in records] - results.sort(key=lambda w: w["created_at"]) except (StorageError, BaseModelError) as err: raise web.HTTPBadRequest(reason=err.roll_up) from err diff --git a/aries_cloudagent/protocols/connections/v1_0/routes.py b/aries_cloudagent/protocols/connections/v1_0/routes.py index bafe178ede..8277484e40 100644 --- a/aries_cloudagent/protocols/connections/v1_0/routes.py +++ b/aries_cloudagent/protocols/connections/v1_0/routes.py @@ -414,20 +414,6 @@ class EndpointsResultSchema(OpenAPISchema): ) -def connection_sort_key(conn): - """Get the sorting key for a particular connection.""" - - conn_rec_state = ConnRecord.State.get(conn["state"]) - if conn_rec_state is ConnRecord.State.ABANDONED: - pfx = "2" - elif conn_rec_state is ConnRecord.State.INVITATION: - pfx = "1" - else: - pfx = "0" - - return pfx + conn["created_at"] - - @docs( tags=["connection"], summary="Query agent-to-agent connections", @@ -488,7 +474,6 @@ async def connections_list(request: web.BaseRequest): alt=True, ) results = [record.serialize() for record in records] - results.sort(key=connection_sort_key) except (StorageError, BaseModelError) as err: raise web.HTTPBadRequest(reason=err.roll_up) from err