Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only check if max_datasets is being exceeded if it's not set to 0 #1079

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading