From 1c06f9dd35c9137d81dce9180424109da7ed54bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=A0ari=C4=87?= Date: Fri, 15 Dec 2023 20:19:35 +0100 Subject: [PATCH] try async --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7c7b188..a737440 100644 --- a/main.py +++ b/main.py @@ -23,7 +23,7 @@ detector = Detector(os.environ['WRITE_SLACK_CHANNEL_ID'], slack_client, repository) @app.route('/api/events', methods=['POST']) -def add_message(): +async def add_message(): content = request.get_json(silent=True) app.logger.info("received incoming event %s", content) if content["type"] == "url_verification": @@ -36,7 +36,7 @@ def add_message(): app.logger.info("Received event contains files") # TODO: switch to manageable list of channel ids if content["event"]["channel"] == os.environ['READ_SLACK_CHANNEL_ID']: - detector.detect(content["event"]["files"][0]["url_private_download"]) + await detector.detect(content["event"]["files"][0]["url_private_download"]) else: app.logger.info(f'Channel ID {content["event"]["channel"]} is not on read list. Skipping event') return "OK"