mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-18 17:28:22 +08:00
daemonize_workers option
This commit is contained in:
@@ -147,7 +147,7 @@ class Sentinel(object):
|
||||
p = Process(target=target, args=args)
|
||||
p.daemon = True
|
||||
if target == worker:
|
||||
p.daemon = False
|
||||
p.daemon = Conf.DAEMINIZE_WORKER
|
||||
p.timer = args[2]
|
||||
self.pool.append(p)
|
||||
p.start()
|
||||
|
||||
@@ -91,6 +91,9 @@ class Conf(object):
|
||||
# sensible default
|
||||
WORKERS = 4
|
||||
|
||||
# Option to undaemonize the workers and allow them to spawn child processes
|
||||
DAEMONIZE_WORKERS = conf.get('daemonize_workers', True)
|
||||
|
||||
# Maximum number of tasks that each cluster can work on
|
||||
QUEUE_LIMIT = conf.get('queue_limit', int(WORKERS) ** 2)
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ workers
|
||||
|
||||
The number of workers to use in the cluster. Defaults to CPU count of the current host, but can be set to a custom number. [#f1]_
|
||||
|
||||
daemonize_workers
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Set the daemon flag when spawning workers. You may need to disable this flag if your worker needs to spawn child process but be carefull with orphaned child processes in case of sudden termination of the main process.
|
||||
Defaults to ``True``.
|
||||
|
||||
recycle
|
||||
~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user