From c348dd3587032cc14250f4c5ce07fa6cf0be55d3 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Mon, 11 Feb 2013 15:48:15 -0500 Subject: [PATCH] Remove get_instance() from SimpleQueueClient SimpleQueueClient was not thread-safe as the pika method calls that we are using might disconnect and end up in a bad state if two threads enqueue messages at the same time. In order to avoid this, each user of the rabbitmq queue gets its own instance of a SimpleQueueClient. (imported from commit 694083b75cd58a60b8de282a8f40eb92a864c5ce) --- zephyr/lib/queue.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zephyr/lib/queue.py b/zephyr/lib/queue.py index aa798ef60f..c69712c08f 100644 --- a/zephyr/lib/queue.py +++ b/zephyr/lib/queue.py @@ -24,13 +24,6 @@ class SimpleQueueClient(object): credentials = pika.PlainCredentials( 'humbug', settings.RABBITMQ_PASSWORD)) - @classmethod - def get_instance(cls): - # When subclassed, we will get one instance per subclass. - if not hasattr(cls, '_instance'): - cls._instance = cls() - return cls._instance - def ready(self): return self.channel is not None