Fix update project time on task changes

Fix project time in non responsive tasks watchdog
This commit is contained in:
allegroai
2021-01-05 18:19:45 +02:00
parent 59994ccf9c
commit e2deff4eef
5 changed files with 53 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
from datetime import datetime
from typing import TypeVar, Callable, Tuple, Sequence
from typing import TypeVar, Callable, Tuple, Sequence, Union
import attr
import six
@@ -153,9 +153,14 @@ def get_possible_status_changes(current_status):
return possible
def update_project_time(project_id):
if project_id:
Project.objects(id=project_id).update(last_update=datetime.utcnow())
def update_project_time(project_ids: Union[str, Sequence[str]]):
if not project_ids:
return
if isinstance(project_ids, str):
project_ids = [project_ids]
return Project.objects(id__in=project_ids).update(last_update=datetime.utcnow())
T = TypeVar("T")