mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-29 15:31:28 +00:00
feature(backups): set job status to error if backup fails
This commit is contained in:
parent
05f2cc3f14
commit
f116ce1bdb
|
@ -202,11 +202,15 @@ class Backups:
|
||||||
job = add_backup_job(service)
|
job = add_backup_job(service)
|
||||||
Jobs.update(job, status=JobStatus.RUNNING)
|
Jobs.update(job, status=JobStatus.RUNNING)
|
||||||
|
|
||||||
|
try:
|
||||||
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)
|
||||||
|
|
||||||
service.post_restore()
|
service.post_restore()
|
||||||
|
except Exception as e:
|
||||||
|
Jobs.update(job, status=JobStatus.ERROR)
|
||||||
|
raise e
|
||||||
|
|
||||||
Jobs.update(job, status=JobStatus.FINISHED)
|
Jobs.update(job, status=JobStatus.FINISHED)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue