Making asynchronous calls

Robert Rawlins robert_rawlins at hotmail.com
Thu Feb 7 04:13:54 PST 2008


Simon McVittie Wrote:
 
>> This should be fine, as long as your client and service are both>> implemented asynchronously (in the sense that we use that word in>> dbus-glib and dbus-python, anyway).Hi Simon,
 
Thanks for getting back to me on this mate, that really was a great explanation so thanks for your help, I'll get around to looking at the source for those other applications. You'll be pleased to hear I'm using Python too so that will no doubt make our lives a great deal simpler.
 
I've done some more messing around with my code here to test what's going on, and it seems that my client is running asyncrousnelealenely. It is posting all the requests off to the service at the same time and then carrying on with its other jobs (for testing purposes this is just a print statement after the calls.) However, I'm wondering if my service isn't quite running right as it still seems to queue my calls.
 
For instance, my client code looks like this:
 
remote_object.HelloWorld("www.someservice.com",
dbus_interface='com.example.SampleInterface',
reply_handler=handle_hello_reply,
error_handler=handle_hello_error)
 

remote_object.HelloWorld("www.someotherservice.com",
dbus_interface='com.example.SampleInterface',
reply_handler=handle_hello_reply,
error_handler=handle_hello_error)
 

remote_object.HelloWorld("www.anotherservice.com",
dbus_interface='com.example.SampleInterface',
reply_handler=handle_hello_reply,
error_handler=handle_hello_error)
 

print "Made Calls"
 
When I run this client code it prints "Made Calls" almost immediately and then over the next 10 seconds or so the service appears to call my callbacks and print the results of the calls to the screen, exactly as I would expect it too. However, If I change that first call to a web address I know doesn't work properly and will return really slowly then I don't get any callbacks called until the first web service call has timed out, then they are both called nice and quickly.
 
Do you see what I mean? My service appears to be quing my requests, which means that if one request runs slowly then it clogs up the queue.
 
Thanks Simon, I appreciate your advice.
 
Rob
_________________________________________________________________
Share what Santa brought you
https://www.mycooluncool.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080207/b4a01bbe/attachment.html 


More information about the dbus mailing list