diff --git a/.deploy/deploy-dev.yaml b/.deploy/deploy-dev.yaml index 53f7193..80e0af2 100644 --- a/.deploy/deploy-dev.yaml +++ b/.deploy/deploy-dev.yaml @@ -5,7 +5,7 @@ services: queues: image: mathwave/sprint-repo:queues networks: - - queues + - queues-development environment: MONGO_HOST: "mongo.develop.sprinthub.ru" MONGO_PASSWORD: $MONGO_PASSWORD_DEV @@ -18,7 +18,5 @@ services: order: start-first networks: - common-infra-nginx: - external: true - queues: + queues-development: external: true diff --git a/.deploy/deploy-prod.yaml b/.deploy/deploy-prod.yaml index 5c1962e..1e94afa 100644 --- a/.deploy/deploy-prod.yaml +++ b/.deploy/deploy-prod.yaml @@ -5,7 +5,6 @@ services: queues: image: mathwave/sprint-repo:queues networks: - - common-infra-nginx - queues environment: MONGO_HOST: "mongo.sprinthub.ru" @@ -19,7 +18,5 @@ services: order: start-first networks: - common-infra-nginx: - external: true queues: external: true diff --git a/.gitea/workflows/deploy-dev.yaml b/.gitea/workflows/deploy-dev.yaml index 0150bdf..3efe3ac 100644 --- a/.gitea/workflows/deploy-dev.yaml +++ b/.gitea/workflows/deploy-dev.yaml @@ -28,7 +28,7 @@ jobs: run: docker push mathwave/sprint-repo:queues deploy-dev: name: Deploy dev - runs-on: [dev] + runs-on: [prod] needs: push steps: - name: login @@ -40,4 +40,4 @@ jobs: - name: deploy env: MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }} - run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra + run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra-development diff --git a/app/routers/take.py b/app/routers/take.py index 9f8c8e4..b56bd1a 100644 --- a/app/routers/take.py +++ b/app/routers/take.py @@ -8,10 +8,17 @@ from app.storage.mongo import tasks router = fastapi.APIRouter() +class Task(pydantic.BaseModel): + id: str + attempt: int + payload: dict + + class Response(pydantic.BaseModel): id: str attempt: int payload: dict + task: Task|None @router.get('/api/v1/take', responses={404: {'description': 'Not found'}}) @@ -19,4 +26,4 @@ async def execute(queue: typing.Annotated[str, fastapi.Header()]) -> Response: task = await tasks.take_task(queue) if not task: raise fastapi.HTTPException(404) - return Response(id=str(task._id), attempt=task.attempts, payload=task.payload) + return Response(id=str(task._id), attempt=task.attempts, payload=task.payload, task=Task(id=str(task._id), attempt=task.attempts, payload=task.payload)) diff --git a/app/storage/mongo/tasks.py b/app/storage/mongo/tasks.py index 0758760..e1b480a 100644 --- a/app/storage/mongo/tasks.py +++ b/app/storage/mongo/tasks.py @@ -1,4 +1,3 @@ -import asyncio import bson import datetime import pydantic