Skip to content

Commit

Permalink
Move touch_last_export_date() call into worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Marishka17 committed Dec 20, 2024
1 parent 81ec1fc commit 0a6dbdc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions cvat/apps/dataset_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def export(
export_fn = task.export_job
db_instance = Job.objects.get(pk=job_id)

db_instance.touch_last_export_date()

cache_ttl = get_export_cache_ttl(db_instance)
cache_dir = db_instance.get_export_cache_directory(create=True)

Expand Down
4 changes: 0 additions & 4 deletions cvat/apps/engine/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,6 @@ def setup_background_job(
failure_ttl=cache_ttl.total_seconds(),
)

self.db_instance.touch_last_export_date()

def get_v1_endpoint_view_name(self) -> str:
"""
Get view name of the endpoint for the first API version
Expand Down Expand Up @@ -766,8 +764,6 @@ def setup_background_job(
failure_ttl=cache_ttl.total_seconds(),
)

self.db_instance.touch_last_export_date()

def get_v1_endpoint_view_name(self) -> str:
"""Get view name of the endpoint for the first API version"""

Expand Down
4 changes: 2 additions & 2 deletions cvat/apps/engine/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from tempfile import NamedTemporaryFile
from typing import Any, Collection, Dict, Iterable, Optional, Union, Type
from zipfile import ZipFile
import logging
from datetime import timedelta

import django_rq
Expand Down Expand Up @@ -1031,11 +1030,12 @@ def create_backup(
# FUTURE-FIXME: there db_instance_id should be passed
db_instance: models.Project | models.Task,
Exporter: Type[ProjectExporter | TaskExporter],
logger: logging.Logger,
logger: Logger,
cache_ttl: timedelta,
):
try:
cache_dir = db_instance.get_export_cache_directory(create=True)
db_instance.touch_last_export_date()
db_instance.refresh_from_db(fields=['updated_date'])
instance_timestamp = timezone.localtime(db_instance.updated_date).timestamp()

Expand Down

0 comments on commit 0a6dbdc

Please sign in to comment.