Skip to content

Commit

Permalink
update user query bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongxuanWang committed Dec 1, 2023
1 parent ae60155 commit 674f0e3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/transactions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@ async def async_get_user_by_username():

# We need to use asyncio because it's very easy to take a long time to query. We do not want that to happen.
try:
users = await asyncio.wait_for(async_get_user_by_username(), timeout=2)
user = await asyncio.wait_for(async_get_user_by_username(), timeout=2)
except asyncio.TimeoutError:
print("Timed out when getting the user!")
return -2, None

for u in users:
if u.username == username:
return 0, u

return -1, None
return -1, user


async def get_transaction(buyer_id: int, club_id: int) -> (int, list):
Expand Down

0 comments on commit 674f0e3

Please sign in to comment.