From ee97c0e83055b44f17d6f6359ec98774220c6e3d Mon Sep 17 00:00:00 2001 From: Nick Farrell Date: Tue, 16 Aug 2022 16:47:45 +0200 Subject: [PATCH] Ensure progress metric is updated frequently during basebackup --- pghoard/basebackup.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pghoard/basebackup.py b/pghoard/basebackup.py index 2e57c448..1409f176 100644 --- a/pghoard/basebackup.py +++ b/pghoard/basebackup.py @@ -718,11 +718,11 @@ def create_and_upload_chunks( # and this assumption greatly simplifies the logic. task_to_wait = pending_compress_and_encrypt_tasks.pop(0) chunk_files.append(task_to_wait.result()) - self.metrics.gauge( - "pghoard.basebackup_estimated_progress", - float(len(chunk_files) * 100 / len(chunks)), - tags={"site": self.site} - ) + self.metrics.gauge( + "pghoard.basebackup_estimated_progress", + float(len(chunk_files) * 100 / len(chunks)), + tags={"site": self.site} + ) if self.chunks_on_disk < max_chunks_on_disk: chunk_id = i + 1 task = tpe.submit( @@ -750,6 +750,8 @@ def create_and_upload_chunks( tags={"site": self.site} ) + self.metrics.gauge("pghoard.basebackup_estimated_progress", float(100), tags={"site": self.site}) + while len(upload_results) < len(chunk_files): self.wait_for_chunk_transfer_to_complete(len(chunks), upload_results, chunk_callback_queue, start_time)