I'm not sure I understand your flow. Here's a canonical example:
>>> c=rpyc.classic.connect("localhost")
>>> c.execute("""def f(a,b):
... import time
... time.sleep(8)
... return a+b""")
>>> f = c.namespace["f"]
>>> af = rpyc.async(f)
>>>
>>>
>>> def cb(res):
... print "I am ready", res
...
>>> ar=af(1,2);ar.add_callback(cb)
>>> ar.wait() # takes 8 seconds...
I am ready <AsyncResult object (ready) at 0x02889d20> # printed by the callback
>>> ar.value
If you set an expiry, wait() will raise an AsyncResultTimeout, and the callback would not be invoked:
>>> ar=af(1,2);ar.set_expiry(3);ar.add_callback(cb);ar.wait()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "rpyc\core\async.py", line 58, in wait
raise AsyncResultTimeout("result expired")
rpyc.core.async.AsyncResultTimeout: result expired
>>> ar.value
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "rpyc\core\async.py", line 113, in value
self.wait()
File "rpyc\core\async.py", line 58, in wait
raise AsyncResultTimeout("result expired")
rpyc.core.async.AsyncResultTimeout: result expired
-tomer