joshmarshall / tornadorpc

Python libraries for XML/JSON RPC using the Tornado framework.
159 stars 36 forks source link

If the function returns a future, handle things asynchronously #11

Closed spanezz closed 9 years ago

spanezz commented 9 years ago

Currently I can use @async to make a xmlrpc server method asynchronous, but with tornado.gen and friends, I tried to make it so that I could use a @gen.coroutine instead. I failed to do so, but at least I managed to make it so that if an xmlrpc method returns a Future, it is run asynchronously and its result is returned transparently. I find it quite handy.

As to using gen.coroutines, at least now I can do this: class RpcHandler(XMLRPCHandler): def foo(self): @gen.coroutine def run(): result1 = yield something(1, 2, 3) result2 = yield somethingelse(3, 4, 5) raise gen.Return(result1 + result2) return run()

spanezz commented 9 years ago

I found an issue, I'm closing this one and opening a new one