Tracht + Tornado + Asink

Is there a way to transfer the Thrift protocol asynchronously through the Tornado web server?

+5
source share
3 answers
twisted:         Generate Twisted-friendly RPC services.
tornado:         Generate code for use with Tornado.

Team thrift -gen py:tornado -out ./ hello.thrift

+1
source

Async really includes two parts: an asynchronous tornado response to reqeust, aysnc communication with a lean server.

0

The easiest way to call the lock function from a coroutine is to use ThreadPoolExecutor, which returns futures compatible with coroutines:

thread_pool = ThreadPoolExecutor(4)

@gen.coroutine
def call_blocking():
    yield thread_pool.submit(blocking_func, args)

blocking_func can use your economical function.

0
source

All Articles