Skip to content

Commit 873b2eb

Browse files
authored
Use create_task when executing the 'after' handler coroutine (#27)
* Use create_task when executing the 'after' handler coroutine * use ensure_future for backwards compatibility
1 parent 4e92dfa commit 873b2eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ocpp/v16/charge_point.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ async def _handle_call(self, msg):
205205

206206
try:
207207
handler = handlers['_after_action']
208-
await asyncio.coroutine(handler)(**snake_case_payload)
208+
# Create task to avoid blocking when making a call inside the
209+
# after handler
210+
asyncio.ensure_future(
211+
asyncio.coroutine(handler)(**snake_case_payload))
209212
except KeyError:
210213
# '_on_after' hooks are not required. Therefore ignore exception
211214
# when no '_on_after' hook is installed.

0 commit comments

Comments
 (0)