Skip to content

Commit

Permalink
respond to webhook in demo immediately
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Whitehead <[email protected]>
  • Loading branch information
andrewwhitehead committed Nov 16, 2019
1 parent b0554e5 commit 3737906
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,14 @@ async def _receive_webhook(self, request: ClientRequest):
topic = request.match_info["topic"]
payload = await request.json()
await self.handle_webhook(topic, payload)
return web.Response(text="")
return web.Response(status=200)

async def handle_webhook(self, topic: str, payload):
if topic != "webhook": # would recurse
handler = f"handle_{topic}"
method = getattr(self, handler, None)
if method:
await method(payload)
asyncio.get_event_loop().create_task(method(payload))
else:
log_msg(
f"Error: agent {self.ident} "
Expand Down

0 comments on commit 3737906

Please sign in to comment.