Skip to content

Commit

Permalink
fix(py-sdk): handle case when function is async
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Oct 3, 2024
1 parent 4c9ad42 commit d20a794
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sdk/py/apepay/manager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import inspect
from collections.abc import Iterator
from datetime import timedelta
from difflib import Differ
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit d20a794

Please sign in to comment.