[fix] don't be blocking on sending message to xmpp

This commit is contained in:
Laurent Peuch 2020-05-04 14:14:27 +02:00
parent f98f2ed245
commit c8645ab3e6

View file

@ -1,6 +1,7 @@
import os import os
import hmac import hmac
import hashlib import hashlib
import asyncio
import subprocess import subprocess
from sanic import Sanic from sanic import Sanic
@ -36,7 +37,9 @@ def notify(message, repository="dev"):
chan = other_chans.get(repository, "dev") chan = other_chans.get(repository, "dev")
print(f"{chan} -> {message}") 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']) @app.route("/github", methods=['GET'])