Skip to content

Commit

Permalink
try async
Browse files Browse the repository at this point in the history
  • Loading branch information
isaric committed Dec 15, 2023
1 parent 9a5c43c commit 1c06f9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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"
Expand Down

0 comments on commit 1c06f9d

Please sign in to comment.