Commit 117155c0 authored by novelailab's avatar novelailab

ugh

parent e7a88e7d
......@@ -86,9 +86,9 @@ def generate(request: GenerationRequest):
return {"error": str(e)}
@app.middleware("http")
def handle_logging_and_errors(request: Request, call_next):
async def handle_logging_and_errors(request: Request, call_next):
t = time.perf_counter()
response = call_next(request)
response = await call_next(request)
process_time = time.time() - t
response.headers["X-Process-Time"] = str(process_time)
logger.info(f"Request took {t:.3f} seconds")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment