feat(chalice): conditional log

This commit is contained in:
Taha Yassine Kraiem 2022-09-19 16:02:21 +01:00
parent b8fc82d2f6
commit 3649061c15

View file

@ -35,7 +35,9 @@ async def or_middleware(request: Request, call_next):
now = int(time.time() * 1000)
response: StreamingResponse = await call_next(request)
if helper.TRACK_TIME:
print(f"Execution time: {int(time.time() * 1000) - now} ms")
now = int(time.time() * 1000) - now
if now > 500:
print(f"Execution time: {now} ms")
except Exception as e:
pg_client.close()
raise e