def gevent_queue(q,msg_queue):
while True:
try:
msg = msg_queue.get(block=True)
log.debug("PID:%d gevent queue start---------------------->" % os.getpid())
if TEST_PROCESS_NUM > 1 and msg == "OK":
for i in range(TEST_PROCESS_NUM-1):
msg_queue.put(os.getpid())
log.debug("PID:%d gevent queue call other processes----" % os.getpid())
glist = []
for i in range(GEVENT_NUM):
glist.append(gevent.spawn(verify_ip_in_queues,q))
gevent.joinall(glist)
l = msg_queue.qsize()
for i in range(l):
msg_queue.get()
log.debug("PID:%d gevent queue end<----------------------" % os.getpid())
except Exception as e:
log.error("PID:%d gevent_queue error:%s" % (os.getpid(),e.message))
评论列表
文章目录