-
If I got it right, synchronous calls to proxy methods block, and will never timeout. This of course in not aways desiderable, so I tried to enforce a timeout in the original exampleand came out with the following code, which works as expected: #
# Say hello to the world.
# Start the server and run the client.
#
from gi.repository import Gio, GLib
from common import HELLO_WORLD
if __name__ == "__main__":
# Create a proxy of the object /org/example/HelloWorld
# provided by the service org.example.HelloWorld
proxy = HELLO_WORLD.get_proxy()
# Call the DBus method Hello and print the return value, timeout after 10ms
try:
print(proxy.Hello("World", timeout=10))
except GLib.Error as err:
if err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.TIMED_OUT):
print("** Timeout **")
else:
raise So, my first question is if this is the correct way of implmenting timeouts? The code looks quite low level, so I'm wondering if I missed a Second question, or better a feature request: shouldn't the timeout mechanism be implemented in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! Your solution looks correct, but I like your suggestion more. It is implemented at #92 and it includes an example in the documentation that should demonstrate the functionality. Thank you for reaching out! |
Beta Was this translation helpful? Give feedback.
Hi! Your solution looks correct, but I like your suggestion more. It is implemented at #92 and it includes an example in the documentation that should demonstrate the functionality. Thank you for reaching out!