fix
All checks were successful
Deploy Dev / Build (pull_request) Successful in 5s
Deploy Dev / Push (pull_request) Successful in 7s
Deploy Dev / Deploy dev (pull_request) Successful in 6s

This commit is contained in:
2024-11-25 00:33:13 +03:00
parent a328d6feb2
commit 5efc884f12
4 changed files with 5 additions and 14 deletions

View File

@@ -3,7 +3,7 @@ import pydantic
import typing
from app.storage.mongo import tasks
from app.storage.redis import lock
from app.storage import redis
router = fastapi.APIRouter()
@@ -17,7 +17,7 @@ class Response(pydantic.BaseModel):
@router.get('/api/v1/take', responses={404: {'description': 'Not found'}})
async def execute(queue: typing.Annotated[str, fastapi.Header()]) -> Response:
async with lock.acquire(queue):
async with redis.database.lock(queue):
task = await tasks.take_task(queue)
if not task:
raise fastapi.HTTPException(404)