From a989d59d935c88a52565d0be8542e70704f325dc Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Thu, 18 Jul 2024 12:17:46 +0200 Subject: [PATCH] src/gateway: serve enumerate cache if present --- src/gateway/lambda_function.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gateway/lambda_function.py b/src/gateway/lambda_function.py index b314268..a4f524c 100644 --- a/src/gateway/lambda_function.py +++ b/src/gateway/lambda_function.py @@ -227,6 +227,14 @@ def _run_enumerate(arguments): ), ) + # Serve the data from the enumerate cache if present + try: + obj = s3c.get_object(Bucket="rpmrepo-storage", Key="data/thread/meta/cache.json") + return _success(json.loads(obj['Body'].read())) + except botocore.exceptions.ClientError as e: + if not e.response['Error']['Code'] == "NoSuchKey": + return _error(500) + prefix = "data/thread/" if "thread" in arguments: prefix = prefix + arguments["thread"] + "/"