mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 04:38:11 +08:00
Makes DB polling time configurable via poll setting
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user