add preload_app setting

This commit is contained in:
benoitc 2010-05-22 19:53:02 +02:00
parent b59b1948a3
commit 776b158683
3 changed files with 18 additions and 2 deletions

View File

@ -46,7 +46,11 @@ class Arbiter(object):
def __init__(self, app):
self.cfg = app.cfg
self.app = app.load()
if self.cfg.preload_app:
self.app = app.load()
else:
self.app = app
self.log = logging.getLogger(__name__)

View File

@ -522,3 +522,13 @@ with Setting("pre_exec") as s:
The callable needs to accept a single instance variable for the Arbiter.
""")
with Setting("preload_app") as s:
s.section = "Server Mechanic"
s.cli = ["--preload"]
s.validator = validate_bool
s.action = "store_true"
s.default = False
s.fmt_desc("""\
Enabling this preloads an application before forking worker processes.
""")

View File

@ -33,7 +33,9 @@ class Worker(object):
self.app = app
self.timeout = timeout
self.cfg = cfg
if not self.cfg.preload_app:
self.app = app.load()
self.nr = 0
self.alive = True
self.spinner = 0