Optimize queues.get_next_task to retrieve required task fields only

This commit is contained in:
allegroai 2023-05-25 19:21:24 +03:00
parent dff2ed34e8
commit 3729afe014

View File

@ -171,7 +171,7 @@ def get_next_task(call: APICall, company_id, request: GetNextTaskRequest):
if entry: if entry:
data = {"entry": entry.to_proper_dict()} data = {"entry": entry.to_proper_dict()}
if request.get_task_info: if request.get_task_info:
task = Task.objects(id=entry.task).first() task = Task.objects(id=entry.task).only("company", "user").first()
if task: if task:
data["task_info"] = {"company": task.company, "user": task.user} data["task_info"] = {"company": task.company, "user": task.user}