Merge pull request #140 from Koed00/dev

Adds poll option for database brokers
This commit is contained in:
Ilan Steemers
2016-01-26 22:56:06 +01:00
4 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ class Mongo(Broker):
if task: if task:
return [(str(task['_id']), task['payload'])] return [(str(task['_id']), task['payload'])]
# empty queue, spare the cpu # empty queue, spare the cpu
sleep(0.2) sleep(Conf.POLL)
def delete_queue(self): def delete_queue(self):
return self.collection.drop() return self.collection.drop()
+1 -1
View File
@@ -61,7 +61,7 @@ class ORM(Broker):
task_list.append((task.pk, task.payload)) task_list.append((task.pk, task.payload))
return task_list return task_list
# empty queue, spare the cpu # empty queue, spare the cpu
sleep(0.2) sleep(Conf.POLL)
def delete_queue(self): def delete_queue(self):
return self.purge_queue() return self.purge_queue()
+3
View File
@@ -50,6 +50,9 @@ class Conf(object):
# ORM broker # ORM broker
ORM = conf.get('orm', None) ORM = conf.get('orm', None)
# Database Poll
POLL = conf.get('poll', 0.2)
# MongoDB broker # MongoDB broker
MONGO = conf.get('mongo', None) MONGO = conf.get('mongo', None)
MONGO_DB = conf.get('mongo_db', None) MONGO_DB = conf.get('mongo_db', None)
+5
View File
@@ -303,6 +303,11 @@ Keep in mind however that settings this too high can degrade performance with mu
Not supported by the default Redis broker. Not supported by the default Redis broker.
Defaults to ``1``. Defaults to ``1``.
poll
~~~~
Sets the queue polling interval for database brokers that don't have a blocking call. Defaults to 0.2 (seconds).
Currently only affects the ORM and MongoDB brokers.
cache cache
~~~~~ ~~~~~
For some brokers, you will need to set up the Django `cache framework <https://docs.djangoproject.com/en/1.8/topics/cache/#setting-up-the-cache>`__ For some brokers, you will need to set up the Django `cache framework <https://docs.djangoproject.com/en/1.8/topics/cache/#setting-up-the-cache>`__