From 8b3db7aa62d1d8d3bd5efc265cc970a67ffb4169 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Wed, 30 Oct 2013 15:25:15 +0100 Subject: [PATCH] Incremental delay when receiving messages (better performance) --- pyrabbit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyrabbit.py b/pyrabbit.py index dfb9ac8..351e98d 100644 --- a/pyrabbit.py +++ b/pyrabbit.py @@ -57,8 +57,11 @@ class Connection(object): t_start = time.time() method = None i = 0 + delay = 0.0 while method is None and (time.time()-t_start < timeout or timeout <= 0): - time.sleep(0.1) + time.sleep(delay) + if delay < 1: + delay += 0.01 method, properties, body = self.channel.basic_get(queues[i]) if i == len(queues) - 1: i = 0 -- 2.39.5