mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
add preload_app setting
This commit is contained in:
parent
b59b1948a3
commit
776b158683
@ -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__)
|
||||
|
||||
|
||||
@ -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.
|
||||
""")
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user