Adds a MongoDB broker

* adds mongo broker tests
* adds mongo brokers docs

* broker info is now cached when it needs to connect to a server, to reduce traffic.
This commit is contained in:
Ilan Steemers
2015-09-25 20:03:39 +02:00
parent ef6a60478a
commit 826178c463
11 changed files with 188 additions and 11 deletions
+4 -2
View File
@@ -21,7 +21,7 @@ class ORM(Broker):
return self.connection.filter(key=self.list_key, lock__lte=_timeout()).count()
def lock_size(self):
return self.connection.filter(key=self.list_key, lock__gte=_timeout()).count()
return self.connection.filter(key=self.list_key, lock__gt=_timeout()).count()
def purge_queue(self):
return self.connection.filter(key=self.list_key).delete()
@@ -30,7 +30,9 @@ class ORM(Broker):
return True
def info(self):
return 'ORM {}'.format(Conf.ORM)
if not self._info:
self._info = 'ORM {}'.format(Conf.ORM)
return self._info
def fail(self, task_id):
self.delete(task_id)