Skip to content

Commit

Permalink
Merge pull request #1079 from opendatacube/fix-logic-cache-control-no…
Browse files Browse the repository at this point in the history
…-max_datasets-master

Only check if max_datasets is being exceeded if it's not set to 0
  • Loading branch information
SpacemanPaul authored Oct 20, 2024
2 parents e802cb3 + b7f7457 commit 11f6787
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datacube_ows/resource_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ def cache_headers(self, n_datasets: int) -> Mapping[str, str]:
if not self.use_caching:
return {}
assert n_datasets >= 0
if n_datasets == 0 or n_datasets > self.max_datasets:
# If there are no datasets, don't cache. But if the max_datasets isn't 0, check
# we're not exceeding it, and in that case, don't cache either.
if n_datasets == 0 or (self.max_datasets > 0 and n_datasets > self.max_datasets):
return cache_control_headers(0)
rule = None
for r in self.rules:
Expand Down

0 comments on commit 11f6787

Please sign in to comment.