feature(backups): also create a job if not called from a task

This commit is contained in:
Houkime 2023-04-24 16:15:12 +00:00 committed by Inex Code
parent b32ca3b11a
commit 029cb47db6

View file

@ -15,6 +15,7 @@ from selfprivacy_api.graphql.queries.providers import BackupProvider
from selfprivacy_api.backup.providers.provider import AbstractBackupProvider from selfprivacy_api.backup.providers.provider import AbstractBackupProvider
from selfprivacy_api.backup.providers import get_provider from selfprivacy_api.backup.providers import get_provider
from selfprivacy_api.backup.storage import Storage from selfprivacy_api.backup.storage import Storage
from selfprivacy_api.backup.jobs import get_backup_job, add_backup_job
class Backups: class Backups:
@ -197,6 +198,9 @@ class Backups:
folders = service.get_folders() folders = service.get_folders()
repo_name = service.get_id() repo_name = service.get_id()
if get_backup_job(service) is None:
add_backup_job(service)
service.pre_backup() service.pre_backup()
snapshot = Backups.provider().backuper.start_backup(folders, repo_name) snapshot = Backups.provider().backuper.start_backup(folders, repo_name)
Backups._store_last_snapshot(repo_name, snapshot) Backups._store_last_snapshot(repo_name, snapshot)