diff --git a/deployment/base/hg-deployment.yaml b/deployment/base/hg-deployment.yaml index f9a6c9c68..4879cd0ef 100644 --- a/deployment/base/hg-deployment.yaml +++ b/deployment/base/hg-deployment.yaml @@ -52,9 +52,9 @@ spec: # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers resources: requests: - memory: 260Mi + memory: 400Mi limits: - memory: 260Mi + memory: 400Mi env: - name: CUSTOM_PORT value: "8088" @@ -65,6 +65,8 @@ spec: configMapKeyRef: name: app-config key: hg-otel-enabled + - name: ENABLE_DEMAND_IMPORT + value: "false" ports: - containerPort: 8088 diff --git a/hgweb/hg.conf b/hgweb/hg.conf index d39d050c0..5df07b828 100644 --- a/hgweb/hg.conf +++ b/hgweb/hg.conf @@ -1,6 +1,6 @@ LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so WSGIPythonOptimize 0 -WSGILazyInitialization Off +WSGILazyInitialization On WSGISocketPrefix logs/wsgi LogLevel debug ServerName localhost diff --git a/hgweb/hgweb.wsgi b/hgweb/hgweb.wsgi index 876a55f3e..298d5aa2d 100644 --- a/hgweb/hgweb.wsgi +++ b/hgweb/hgweb.wsgi @@ -1,3 +1,5 @@ +import os +import sys # An example WSGI for use with mod_wsgi, edit as necessary # See https://mercurial-scm.org/wiki/modwsgi for more information # mod_wsgi docs: https://modwsgi.readthedocs.io/en/master/ @@ -13,7 +15,13 @@ config = b"/var/hg/hgweb.hgrc" #import cgitb; cgitb.enable() # enable demandloading to reduce startup time -from mercurial import demandimport; demandimport.enable() +from mercurial import demandimport; + +# enable demandloading to reduce startup time +if os.getenv('ENABLE_DEMAND_IMPORT', 'false').lower() in ['1', 'true', 'yes']: + demandimport.enable() +else: + demandimport.disable() from mercurial.hgweb import hgweb application = hgweb(config)