fix ignoring progress message when not initiated with task

This commit is contained in:
simon 2023-05-04 11:48:38 +07:00
parent b95a659396
commit 170839362e
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 4 additions and 2 deletions

View File

@ -32,7 +32,8 @@ class ElasticBackup:
if not self.reason:
raise ValueError("missing backup reason in ElasticBackup")
self.task.send_progress(["Scanning your index."])
if self.task:
self.task.send_progress(["Scanning your index."])
for index in self.index_config:
index_name = index["index_name"]
print(f"backup: export in progress for {index_name}")
@ -42,7 +43,8 @@ class ElasticBackup:
self.backup_index(index_name)
self.task.send_progress(["Compress files to zip archive."])
if self.task:
self.task.send_progress(["Compress files to zip archive."])
self.zip_it()
if self.reason == "auto":
self.rotate_backup()