Zero server returned result was not right when client started in multi threads
Closed this issue · 2 comments
acewhitegui commented
This is my test script:
server:
import time
from zero import ZeroServer
def echo(msg: str) -> str:
# mock do something
time.sleep(5)
return msg
if __name__ == "__main__":
app = ZeroServer(port=5559)
app.register_rpc(echo)
app.run()
client:
from zero import ZeroClient
from threading import Thread
def test(index):
zero_client = ZeroClient("localhost", 5559, 20000)
data = zero_client.call("echo", f"{index}")
print(data)
if __name__ == "__main__":
for i in range(16):
Thread(target=test, args=(i,)).start()
Ananto30 commented
acewhitegui commented
Yes,It's my console problem.Sorry for that.