Makes DB polling time configurable via poll setting

This commit is contained in:
Ilan Steemers
2016-01-26 22:29:00 +01:00
parent 9baf1b6394
commit af3b1da08f
3 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ class Mongo(Broker):
if task:
return [(str(task['_id']), task['payload'])]
# empty queue, spare the cpu
sleep(0.2)
sleep(Conf.POLL)
def delete_queue(self):
return self.collection.drop()
+1 -1
View File
@@ -61,7 +61,7 @@ class ORM(Broker):
task_list.append((task.pk, task.payload))
return task_list
# empty queue, spare the cpu
sleep(0.2)
sleep(Conf.POLL)
def delete_queue(self):
return self.purge_queue()
+3
View File
@@ -50,6 +50,9 @@ class Conf(object):
# ORM broker
ORM = conf.get('orm', None)
# Database Poll
POLL = conf.get('poll', 0.2)
# MongoDB broker
MONGO = conf.get('mongo', None)
MONGO_DB = conf.get('mongo_db', None)