feature(backups): set job status to error if backup fails

pull/35/head
Houkime 2023-05-08 10:55:22 +00:00 committed by Inex Code
parent 05f2cc3f14
commit f116ce1bdb
1 changed files with 8 additions and 4 deletions

View File

@ -202,11 +202,15 @@ class Backups:
job = add_backup_job(service)
Jobs.update(job, status=JobStatus.RUNNING)
service.pre_backup()
snapshot = Backups.provider().backuper.start_backup(folders, repo_name)
Backups._store_last_snapshot(repo_name, snapshot)
try:
service.pre_backup()
snapshot = Backups.provider().backuper.start_backup(folders, repo_name)
Backups._store_last_snapshot(repo_name, snapshot)
service.post_restore()
except Exception as e:
Jobs.update(job, status=JobStatus.ERROR)
raise e
service.post_restore()
Jobs.update(job, status=JobStatus.FINISHED)
@staticmethod