Skip to content

Commit

Permalink
fix: use time.sleep instead of asyncio.sleep in non-corountine function
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Nov 23, 2023
1 parent 5808b7a commit 1ccffd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import asyncio
import time
import uuid
from pathlib import Path
from typing import Annotated
Expand Down Expand Up @@ -124,7 +124,7 @@ def authentication(
crud.create_user(db, user=user)
return {"access_token": token, "token_type": "bearer"}
elif r.status_code == 403:
asyncio.sleep(2) # prevents brute-force
time.sleep(2) # prevents brute-force
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Invalid authentication credentials",
Expand Down

0 comments on commit 1ccffd6

Please sign in to comment.