Skip to content

Commit

Permalink
limit threadpool sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Aug 15, 2021
1 parent 9a58fe2 commit b136f20
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sentinelsat/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ def download_all(self, products, directory="."):
# Two separate threadpools for downloading and triggering of retrieval.
# Otherwise triggering might take up all threads and nothing is downloaded.
with ThreadPoolExecutor(
max_workers=self.n_concurrent_dl, thread_name_prefix="dl"
max_workers=min(self.n_concurrent_dl, len(product_infos)), thread_name_prefix="dl"
) as dl_executor, ThreadPoolExecutor(
max_workers=self.api.concurrent_lta_trigger_limit, thread_name_prefix="trigger"
max_workers=min(self.api.concurrent_lta_trigger_limit, len(offline_prods)),
thread_name_prefix="trigger",
) as trigger_executor:
# First all online products are downloaded. Subsequently, offline products that might
# have become available in the meantime are requested.
Expand Down

0 comments on commit b136f20

Please sign in to comment.