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

This commit is contained in:
Houkime 2023-05-08 10:55:22 +00:00 committed by Inex Code
parent 05f2cc3f14
commit f116ce1bdb

View file

@ -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