You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2022/02/02 11:54:30 UTC
[incubator-ponymail-foal] 01/03: Also cleanup from ^C
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit b879712a3aafe53c9f34c30fa5b35ed43a9a9890
Author: Sebb <se...@apache.org>
AuthorDate: Wed Feb 2 11:53:08 2022 +0000
Also cleanup from ^C
---
server/main.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/server/main.py b/server/main.py
index abed550..8dc324e 100644
--- a/server/main.py
+++ b/server/main.py
@@ -235,16 +235,19 @@ class Server(plugins.server.BaseServer):
% (self.config.server.ip, self.config.server.port)
)
await plugins.background.run_tasks(self)
+ await self.cleanup()
+ await site.stop() # try to clean up
+
+ async def cleanup(self):
while not self.dbpool.empty():
await self.dbpool.get_nowait().client.close()
- await site.stop() # try to clean up
def run(self):
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(self.server_loop())
except KeyboardInterrupt:
- pass
+ loop.run_until_complete(self.cleanup())
loop.close()