From 30387d255bf8f99363da4daaf6bdf37616b677fa Mon Sep 17 00:00:00 2001 From: Calum Chamberlain Date: Wed, 12 Jun 2024 20:05:02 +1200 Subject: [PATCH] Avoid division by 0 --- rt_eqcorrscan/database/database_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rt_eqcorrscan/database/database_manager.py b/rt_eqcorrscan/database/database_manager.py index 6881aa3..cfd12d3 100644 --- a/rt_eqcorrscan/database/database_manager.py +++ b/rt_eqcorrscan/database/database_manager.py @@ -134,7 +134,7 @@ def _chunksize( divisor: int = 100, # Used to give more up-to-date progress reports ) -> int: max_workers = max_workers or cpu_count() - chunksize = n_tasks // (max_workers - 1) + chunksize = n_tasks // max(1, max_workers - 1) chunksize //= divisor return max(chunksize, 1)