Skip to content

Commit

Permalink
🔥 remove unnecessary record sorts (now that askar sorts by id == sort…
Browse files Browse the repository at this point in the history
…ing by created_at)

Signed-off-by: ff137 <ff137@proton.me>
  • Loading branch information
ff137 committed Aug 30, 2024
1 parent c08e416 commit 9e97c9e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
1 change: 0 additions & 1 deletion aries_cloudagent/multitenant/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 0 additions & 15 deletions aries_cloudagent/protocols/connections/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 9e97c9e

Please sign in to comment.