fix
This commit is contained in:
parent
0228bd03fe
commit
7b96aa6315
17
server.py
17
server.py
@ -2,7 +2,6 @@ import asyncio
|
||||
import datetime
|
||||
import grpc
|
||||
import bson
|
||||
import os
|
||||
|
||||
from queues import tasks_pb2
|
||||
from queues import tasks_pb2_grpc
|
||||
@ -10,18 +9,6 @@ from queues import tasks_pb2_grpc
|
||||
from utils import time
|
||||
from storage.mongo import tasks
|
||||
|
||||
from utils import configurator
|
||||
|
||||
|
||||
DEFAULT_RETRY_AFTER = 0.2
|
||||
|
||||
|
||||
client = configurator.Client(
|
||||
'queues',
|
||||
os.environ['STAGE'],
|
||||
need_poll=True,
|
||||
)
|
||||
|
||||
|
||||
def get_feature(feature_db, point):
|
||||
"""Returns Feature at given location or None."""
|
||||
@ -49,9 +36,7 @@ class TasksServicer(tasks_pb2_grpc.TasksServicer):
|
||||
task = await tasks.take_task(request.queue)
|
||||
if not task:
|
||||
return tasks_pb2.TakeResponse(task=None)
|
||||
retry_after_settings = client.get_config('retry_after_settings')
|
||||
retry_after = retry_after_settings.get(request.queue) or retry_after_settings.get('__default__') or DEFAULT_RETRY_AFTER
|
||||
return tasks_pb2.TakeResponse(task=tasks_pb2.Task(id=str(task._id), attempt=task.attempts, payload=task.payload), retry_after=retry_after)
|
||||
return tasks_pb2.TakeResponse(task=tasks_pb2.Task(id=str(task._id), attempt=task.attempts, payload=task.payload))
|
||||
|
||||
async def Finish(self, request: tasks_pb2.FinishRequest, context) -> tasks_pb2.EmptyResponse:
|
||||
if await tasks.finish_task(bson.ObjectId(request.id)):
|
||||
|
Loading…
Reference in New Issue
Block a user