altdesktop / python-dbus-next

🚌 The next great DBus library for Python with asyncio support
https://python-dbus-next.readthedocs.io/en/latest/
MIT License
187 stars 59 forks source link

missing timeout for dbus calls via proxy object #92

Closed pruckebusch closed 3 years ago

pruckebusch commented 3 years ago

When a dbus call via a proxy object method does not return, it is awaited indefinitely by the caller. It might be a good idea to also add timeouts to the method and properties added on a proxy-object, as is done for the introspect method (https://github.com/altdesktop/python-dbus-next/pull/7).

We saw this issue when using dbus-next to in combination with bluez.

michallowasrzechonek-silvair commented 3 years ago

How about asyncio.wait_for?

acrisci commented 3 years ago

I think it was a mistake to add that timeout param. I should deprecate it. I don't want to add a timeout to everything. It's better to use the built in asyncio timeout function.

pruckebusch commented 3 years ago

Thanks for the quick response.

IMHO it is something that should be facilitated by the library, i.e. embed asyncio timeout inside the calls. Otherwise all calls need to be protected by the user which makes the business logic of an application less readable.

Anyway, as we saw this behavior we will add the functionality. If desired, we can always make a PR.