aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-02-04 16:26:58 -0800
committerBryan Newbold <bnewbold@robocracy.org>2022-02-04 16:26:58 -0800
commitd2191728cebbfd357af8ffa6d9461910b3412448 (patch)
tree8a9b0a6176166219096a9a05c9279caa26ae41dc /python/fatcat_web
parent54f9f9feb0e5ff954b3f8160d650f941c02bd8f8 (diff)
downloadfatcat-d2191728cebbfd357af8ffa6d9461910b3412448.tar.gz
fatcat-d2191728cebbfd357af8ffa6d9461910b3412448.zip
search: add a circuit break on very large volume ranges
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/search.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py
index ad27d77b..b069e315 100644
--- a/python/fatcat_web/search.py
+++ b/python/fatcat_web/search.py
@@ -869,6 +869,8 @@ def get_elastic_container_preservation_by_volume(query: ReleaseQuery) -> List[di
[int(h["key"]["volume"]) for h in buckets if h["key"]["volume"].isdigit()]
)
volume_dicts = dict()
+ if max(volume_nums) - min(volume_nums) > 500:
+ raise Exception("too many volume histogram buckets")
if volume_nums:
for num in range(min(volume_nums), max(volume_nums) + 1):
volume_dicts[num] = dict(volume=num, bright=0, dark=0, shadows_only=0, none=0)