Skip to content

Commit

Permalink
[asgi] fix UnboundLocalError local variable 'start' referenced before…
Browse files Browse the repository at this point in the history
… assignment

see #1883
  • Loading branch information
thomasleveil committed Jul 21, 2023
1 parent 6ae8d62 commit 1def242
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ async def __call__(self, scope, receive, send):
receive: An awaitable callable yielding dictionaries
send: An awaitable callable taking a single dictionary as argument.
"""
start = default_timer()
if scope["type"] not in ("http", "websocket"):
return await self.app(scope, receive, send)

Expand Down Expand Up @@ -591,7 +592,6 @@ async def __call__(self, scope, receive, send):
send,
duration_attrs,
)
start = default_timer()

await self.app(scope, otel_receive, otel_send)
finally:
Expand Down

0 comments on commit 1def242

Please sign in to comment.