Andrej A Antonov added the comment:
@demian.brecht , for high probably to catch *infinite_freeze* (at GNU/Linux) --
if we may will run requests of "xmlrpc.client.ServerProxy" -- parallely:
(when running next code -- need to make some network-disconnections on
"network-router-computer")
#!/usr/bin/env python3
import threading
from xmlrpc.client import ServerProxy
ITERATION_COUNT = 100
THREAD_COUNT = 100
def thread_func(thread_name):
for i in range(ITERATION_COUNT):
try:
server = ServerProxy("http://betty.userland.com")
rpc_result = server.examples.getStateName(41)
print('{}/iter_{} {!r}'.format(thread_name, i, rpc_result))
except Exception as e:
print('{}/iter_{} error: {} {}'.format(thread_name, i, type(e),
str(e)))
def main():
print('***** testing begin *****')
thread_list = []
for i in range(THREAD_COUNT):
thread_name = 'thread_{}'.format(i)
thread_list.append(threading.Thread(target=thread_func,
args=(thread_name,)))
for thr in thread_list:
thr.start()
for thr in thread_list:
thr.join()
print('***** testing end *****')
if __name__ == '__main__':
main()
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14134>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com