summaryrefslogtreecommitdiff
path: root/tools/simulator.py
diff options
context:
space:
mode:
authorozamiatin <ozamiatin@mirantis.com>2016-02-26 13:06:44 +0200
committerozamiatin <ozamiatin@mirantis.com>2016-02-26 13:15:00 +0200
commit681f631123671ca07b370637f817d742f64d40f5 (patch)
tree59e91c6cd75a873b5fae918a01927c801c6f9dd7 /tools/simulator.py
parenta95035c264499abf9690b2b266d339cce694448c (diff)
downloadoslo-messaging-681f631123671ca07b370637f817d742f64d40f5.tar.gz
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
Diffstat (limited to 'tools/simulator.py')
-rwxr-xr-xtools/simulator.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/simulator.py b/tools/simulator.py
index d9ca8d8..1729b3f 100755
--- a/tools/simulator.py
+++ b/tools/simulator.py
@@ -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)