Skip to content

Commit 6473180

Browse files
[PR #10884/d758b7ae backport][3.12] Fix flakey middleware connection reuse test (#10887)
Co-authored-by: J. Nick Koston <[email protected]>
1 parent 5044d53 commit 6473180

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)