Skip to content

Commit d758b7a

Browse files
authored
Fix flakey middleware connection reuse test (#10884)
1 parent 3c9d7ab commit d758b7a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_client_middleware.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,11 +847,12 @@ async def __call__(
847847
retry_count = 0
848848
while True:
849849
self.attempt_count += 1
850+
response = await handler(request)
850851
if retry_count == 0:
851852
retry_count += 1
852-
await handler(request)
853+
response.release() # Release the response to enable connection reuse
853854
continue
854-
return await handler(request)
855+
return response
855856

856857
app = web.Application()
857858
app.router.add_get("/", handler)

0 commit comments

Comments
 (0)