From 621b0a8b2d561d9c1cfb3f3e1e4c5f67850d4aa9 Mon Sep 17 00:00:00 2001
From: Alan De Smet <alan.desmet@ssec.wisc.edu>
Date: Fri, 3 Sep 2021 16:54:40 +0000
Subject: [PATCH] Call DownloadStats.finish() when done

Previously we relied on DownloadStats.report() to do it, but we don't
guarantee that will happen anymore. And really, when
Downloader.update_cache or Downloader.download_for_time finish, it's
done and should be marked as such.
---
 csppfetch/__init__.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/csppfetch/__init__.py b/csppfetch/__init__.py
index 16ef5ff..6a047d2 100644
--- a/csppfetch/__init__.py
+++ b/csppfetch/__init__.py
@@ -960,6 +960,7 @@ class Downloader:
             retries = 1
         stats = DownloadStatistics(progress=progress)
         self.download_first_available(filesets, dst, timeout=timeout, retries=retries, retry_wait=retry_wait, do_download = do_download, download_stats = stats)
+        stats.finish()
         return stats
 
 
@@ -1005,6 +1006,7 @@ class Downloader:
                 # We just keep trucking on; missed files are unfortunate,
                 # but not much we can do.
                 pass
+        download_stats.finish()
         return download_stats
 
 
-- 
GitLab