From c8645ab3e6f53db45c81fc2eff6b12dab37d10c4 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 4 May 2020 14:14:27 +0200 Subject: [PATCH] [fix] don't be blocking on sending message to xmpp --- server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index ac4b274..bfd618c 100644 --- a/server.py +++ b/server.py @@ -1,6 +1,7 @@ import os import hmac import hashlib +import asyncio import subprocess from sanic import Sanic @@ -36,7 +37,9 @@ def notify(message, repository="dev"): chan = other_chans.get(repository, "dev") print(f"{chan} -> {message}") - subprocess.check_call(["python", "./to_room.py", gitbot_password, message, chan]) + proc = await asyncio.create_subprocess_shell(f"python ./to_room.py '{gitbot_password}' '{message}' '{chan}'") + await proc.communicate() + await proc.wait() @app.route("/github", methods=['GET'])