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)
This commit is contained in:
Leo Franchi 2013-02-11 15:48:15 -05:00
parent 0a0c4bb9a0
commit c348dd3587
1 changed files with 0 additions and 7 deletions

View File

@ -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