Make simulator more asynchronous

We need to use eventlet.sleep() in green thread loops
in order to have more chances to switch between them.

Change-Id: I7c08e82182b68b95c36265d58df0644c5ce2c171
This commit is contained in:
ozamiatin 2016-02-26 13:06:44 +02:00
parent a95035c264
commit 681f631123

View File

@ -274,10 +274,12 @@ def send_msg(c_id, transport, target, wait_after_msg, timeout, is_cast,
with timeutils.StopWatch(duration) as stop_watch:
while not stop_watch.expired():
client.send_msg()
eventlet.sleep()
else:
LOG.debug("Sending %d messages using client %d", messages_count, c_id)
for _ in six.moves.range(0, messages_count):
client.send_msg()
eventlet.sleep()
LOG.debug("Client %d has sent %d messages", c_id, messages_count)