dispatchrun / dispatch-py

Python package to develop applications with Dispatch.
https://pypi.org/project/dispatch-py/
Apache License 2.0
54 stars 3 forks source link

fix coroutine decoration #81

Closed achille-roussel closed 7 months ago

achille-roussel commented 7 months ago

Fixes a regression introduced in #79

The problem was caused by wrapping the original function with the durable decorator, which loses information about the fact that the underlying function is a coroutine. Using inspect.iscoroutinefunction on the decorated object always returns False.

The fix isn't the most pretty, basically adding a boolean parameter (what can't be fixed by an extra boolean? 😅) to track whether we are registering a coroutine or a simple function.