fix
This commit is contained in:
parent
11c3026738
commit
2ff6c22e0b
@ -9,8 +9,6 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
||||||
REDIS_HOST: "redis.develop.sprinthub.ru"
|
|
||||||
REDIS_PASSWORD: $REDIS_PASSWORD_DEV
|
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
|
@ -9,8 +9,6 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.sprinthub.ru"
|
MONGO_HOST: "mongo.sprinthub.ru"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
||||||
REDIS_HOST: "redis.sprinthub.ru"
|
|
||||||
REDIS_PASSWORD: $REDIS_PASSWORD_PROD
|
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
|
@ -40,5 +40,4 @@ jobs:
|
|||||||
- name: deploy
|
- name: deploy
|
||||||
env:
|
env:
|
||||||
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }}
|
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }}
|
||||||
REDIS_PASSWORD_DEV: ${{ secrets.REDIS_PASSWORD_DEV }}
|
|
||||||
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra-development
|
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra-development
|
||||||
|
@ -40,5 +40,4 @@ jobs:
|
|||||||
- name: deploy
|
- name: deploy
|
||||||
env:
|
env:
|
||||||
MONGO_PASSWORD_PROD: ${{ secrets.MONGO_PASSWORD_PROD }}
|
MONGO_PASSWORD_PROD: ${{ secrets.MONGO_PASSWORD_PROD }}
|
||||||
REDIS_PASSWORD_PROD: ${{ secrets.REDIS_PASSWORD_PROD }}
|
|
||||||
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-prod.yaml infra
|
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-prod.yaml infra
|
||||||
|
@ -17,8 +17,7 @@ class Response(pydantic.BaseModel):
|
|||||||
|
|
||||||
@router.get('/api/v1/take', responses={404: {'description': 'Not found'}})
|
@router.get('/api/v1/take', responses={404: {'description': 'Not found'}})
|
||||||
async def execute(queue: typing.Annotated[str, fastapi.Header()]) -> Response:
|
async def execute(queue: typing.Annotated[str, fastapi.Header()]) -> Response:
|
||||||
async with redis.database.lock(queue):
|
task = await tasks.take_task(queue)
|
||||||
task = await tasks.take_task(queue)
|
|
||||||
if not task:
|
if not task:
|
||||||
raise fastapi.HTTPException(404)
|
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)
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
import os
|
|
||||||
import redis.asyncio as connection
|
|
||||||
|
|
||||||
|
|
||||||
REDIS_HOST = os.getenv('REDIS_HOST', 'localhost')
|
|
||||||
REDIS_PASSWORD = os.getenv('REDIS_PASSWORD')
|
|
||||||
|
|
||||||
|
|
||||||
database = connection.Redis(host=REDIS_HOST, password=REDIS_PASSWORD)
|
|
Loading…
Reference in New Issue
Block a user