From d9da01a04fcfc006f42c1779bc3f968fc86a90e0 Mon Sep 17 00:00:00 2001 From: Kian-Tat Lim Date: Thu, 12 Sep 2024 22:18:07 +0000 Subject: [PATCH] Wait for stream close before returning from callback. --- python/s3daemon/s3daemon.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/s3daemon/s3daemon.py b/python/s3daemon/s3daemon.py index fe4669a..cac2c69 100644 --- a/python/s3daemon/s3daemon.py +++ b/python/s3daemon/s3daemon.py @@ -73,6 +73,9 @@ async def handle_client(client, reader, writer): writer.write(b"Success") except Exception as e: writer.write(bytes(repr(e), "UTF-8")) + await writer.drain() + writer.close() + await writer.wait_closed() log.info("%f %f sec", start, time.time() - start)