From d20a7948facd37564599b5b4cf6b27e99750e2c1 Mon Sep 17 00:00:00 2001 From: fubuloubu <3859395+fubuloubu@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:00:38 -0400 Subject: [PATCH] fix(py-sdk): handle case when function is async --- sdk/py/apepay/manager.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sdk/py/apepay/manager.py b/sdk/py/apepay/manager.py index b506245..12f6cd7 100644 --- a/sdk/py/apepay/manager.py +++ b/sdk/py/apepay/manager.py @@ -1,3 +1,4 @@ +import inspect from collections.abc import Iterator from datetime import timedelta from difflib import Differ @@ -214,8 +215,13 @@ def decorator(f): @app.on_(container) @wraps(f) - def inner(log, **dependencies): - return f(Stream(manager=self, id=log.stream_id), **dependencies) + async def inner(log, **dependencies): + result = f(Stream(manager=self, id=log.stream_id), **dependencies) + + if inspect.isawaitable(result): + return await result + + return result return inner