From: Javier Sancho Date: Wed, 30 Oct 2013 14:25:15 +0000 (+0100) Subject: Incremental delay when receiving messages (better performance) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=HEAD;p=pyrabbit.git Incremental delay when receiving messages (better performance) --- 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