1
在一個Python模塊中,我正在做一些東西。在做這些事情的過程中,我創建了一個Thrift連接。問題在於連接開始後,程序停滯在網絡邏輯中。 (即阻塞)。非阻塞服務器Apache Thrift Python
在模塊A,我有:
stuff = "do some stuff"
network.ConnectionManager(host, port, ...)
stuff = "do more stuff" # not getting to this point
在網絡......
ConnectionManager.start_service_handler()
def start_service_handler(self):
handler = ServiceHandler(self)
processor = Service.Processor(handler)
transport = TSocket.TServerSocket(port=self.port)
tfactory = TTransport.TBufferedTransportFactory()
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
# server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
server = TNonblockingServer(processor, transport, tfactory, pfactory)
logger().info('starting server...')
server.serve()
我嘗試這一點,但在模塊A尚碼作爲連接代碼開始不會馬上繼續。
我以爲TNonblockingServer會做的伎倆,但不幸的是沒有。