mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-09 07:58:11 +08:00
Merge pull request #32 from Koed00/dev
Adds queue limit and encryption salt
This commit is contained in:
+1
-1
@@ -132,7 +132,7 @@ class Sentinel(object):
|
||||
self.pool_size = Conf.WORKERS
|
||||
self.pool = []
|
||||
self.timeout = timeout
|
||||
self.task_queue = Queue()
|
||||
self.task_queue = Queue(maxsize=Conf.QUEUE_LIMIT) if Conf.QUEUE_LIMIT else Queue()
|
||||
self.result_queue = Queue()
|
||||
self.event_out = Event()
|
||||
self.monitor = Process()
|
||||
|
||||
@@ -33,6 +33,9 @@ class Conf(object):
|
||||
# Failures are always saved
|
||||
SAVE_LIMIT = conf.get('save_limit', 250)
|
||||
|
||||
# Maximum number of tasks that each cluster can work on
|
||||
QUEUE_LIMIT = conf.get('queue_limit', None)
|
||||
|
||||
# Number of workers in the pool. Default is cpu count. +2 for monitor and pusher
|
||||
WORKERS = conf.get('workers', cpu_count())
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ class SignedPackage(object):
|
||||
def dumps(obj, compressed=Conf.COMPRESSED):
|
||||
return signing.dumps(obj,
|
||||
key=Conf.SECRET_KEY,
|
||||
salt='django_q.q',
|
||||
salt=Conf.PREFIX,
|
||||
compress=compressed,
|
||||
serializer=PickleSerializer)
|
||||
|
||||
@@ -27,7 +27,7 @@ class SignedPackage(object):
|
||||
def loads(obj):
|
||||
return signing.loads(obj,
|
||||
key=Conf.SECRET_KEY,
|
||||
salt='django_q.q',
|
||||
salt=Conf.PREFIX,
|
||||
serializer=PickleSerializer)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user