Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

Sleep before retrying, not on first attempt (#458)

Kristoffer Sjöbergfc6a84e14e2d
diff --git a/ministack/services/lambda_svc.py b/ministack/services/lambda_svc.py
index 2fbcfba1..bea3fda1 100644
--- a/ministack/services/lambda_svc.py
+++ b/ministack/services/lambda_svc.py
@@ -1871,7 +1871,6 @@ def _invoke_rie(container, event: dict, timeout: int) -> dict:
import urllib.request
max_attempts = int(timeout * 10) + 20
for _attempt in range(max_attempts):
- time.sleep(0.1)
container.reload()
if container.status != "running":
break
@@ -1922,6 +1921,7 @@ def _invoke_rie(container, event: dict, timeout: int) -> dict:
result["function_error"] = "Unhandled" if err_header else "Handled"
return result
except (urllib.error.URLError, ConnectionRefusedError, OSError):
+ time.sleep(0.1)
continue
# Timed out
stdout = container.logs(stdout=True, stderr=True).decode("utf-8", errors="replace").strip()