From faf3b5d5bdc891daf247293fbdc6210d71c18420 Mon Sep 17 00:00:00 2001 From: Luke Munro Date: Wed, 11 Dec 2024 16:57:31 -0500 Subject: [PATCH] Fix sleep time conditional (#644) - Conditional for sleep time should check sleep_time not time_delta Example error: https://demo.sentry.io/issues/6131235906/events/3235cb0fb30d45da956bc065ad6f562b/?project=5808655 --- flask/src/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/src/main.py b/flask/src/main.py index 68fb1f0e..a4ed4a71 100644 --- a/flask/src/main.py +++ b/flask/src/main.py @@ -281,7 +281,7 @@ def get_api_request(key, delay): time_delta = time.time() - start_time sleep_time = delay - time_delta - if time_delta > 0: + if sleep_time > 0: time.sleep(sleep_time) # For demo show we want to show cache misses so only save 1 / 100