mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 20:11:30 +00:00
refactor(backups): make a backup job running when the backup code itself is executed
This commit is contained in:
parent
c0dfbb3ca2
commit
ad6cc5e1bc
|
@ -14,6 +14,7 @@ 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
|
from selfprivacy_api.backup.jobs import get_backup_job, add_backup_job
|
||||||
|
from selfprivacy_api.jobs import Jobs, JobStatus
|
||||||
|
|
||||||
|
|
||||||
class Backups:
|
class Backups:
|
||||||
|
@ -196,8 +197,10 @@ 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:
|
job = get_backup_job(service)
|
||||||
add_backup_job(service)
|
if job is None:
|
||||||
|
job = add_backup_job(service)
|
||||||
|
Jobs.update(job, status=JobStatus.RUNNING)
|
||||||
|
|
||||||
service.pre_backup()
|
service.pre_backup()
|
||||||
snapshot = Backups.provider().backuper.start_backup(folders, repo_name)
|
snapshot = Backups.provider().backuper.start_backup(folders, repo_name)
|
||||||
|
|
Loading…
Reference in a new issue