Mercurial > p > roundup > code
changeset 7819:0fe2b9f6e19f
issue2551212 - enable wsgi cache_tracker by default
Switch the code so the wsgi cache_tracker optimization is enabled by
default. Leave the unoptimized/uncached code path available in case it
breaks something. The feature flag can be set to False to disable
caching.
Updated tests to test the disabled (non-cache) code path.
Updated upgrading.txt with info on how to disable caching.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 20 Mar 2024 17:13:30 -0400 |
| parents | a44c5da250fa |
| children | da4c51effdfd |
| files | CHANGES.txt doc/upgrading.txt roundup/cgi/wsgi_handler.py test/test_liveserver.py |
| diffstat | 4 files changed, 33 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Wed Mar 20 12:06:46 2024 -0400 +++ b/CHANGES.txt Wed Mar 20 17:13:30 2024 -0400 @@ -143,7 +143,9 @@ machine parsible output. (John Rouillard) - Multiple JWT secrets are supported to allow key rotation. See an updated config.ini for details. (John Rouillard) - +- issue2551212 - wsgi performance improvement feature added in 2.2.0 + is active by default. Can be turned off if needed. See upgrading.txt + for info. (John Rouillard) 2023-07-13 2.3.0
--- a/doc/upgrading.txt Wed Mar 20 12:06:46 2024 -0400 +++ b/doc/upgrading.txt Wed Mar 20 17:13:30 2024 -0400 @@ -112,6 +112,24 @@ This will insert the bad API login rate limiting settings. +Disable performance improvement for wsgi mode (optional) +-------------------------------------------------------- + +In Roundup version 2.2.0 an experimental option to improve performance +when running in wsgi mode was added. It as disabled at that time. In +the last two years it has been in use at a few sits with no reports of +issues. + +So the default mode is now to enable this improvement. This will get +more people using it. In case there is a latent bug that hasn't been +discovered, it can still be disabled. To disable it, add the +feature_flags to the RequestDispatcher as below: + + feature_flags = { "cache_tracker": False } + app = RequestDispatcher(tracker_home, feature_flags=feature_flags) + +and restart your wsgi instance. + Fix duplicate id for confirm password in user.item.html (optional) ------------------------------------------------------------------
--- a/roundup/cgi/wsgi_handler.py Wed Mar 20 12:06:46 2024 -0400 +++ b/roundup/cgi/wsgi_handler.py Wed Mar 20 17:13:30 2024 -0400 @@ -98,7 +98,8 @@ else: self.translator = None - if "cache_tracker" in self.feature_flags: + if "cache_tracker" not in self.feature_flags or \ + self.feature_flags["cache_tracker"] is not False: self.tracker = roundup.instance.open(self.home, not self.debug) else: self.preload() @@ -133,7 +134,8 @@ else: form = BinaryFieldStorage(fp=environ['wsgi.input'], environ=environ) - if "cache_tracker" in self.feature_flags: + if "cache_tracker" not in self.feature_flags or \ + self.feature_flags["cache_tracker"] is not False: client = self.tracker.Client(self.tracker, request, environ, form, self.translator) try:
--- a/test/test_liveserver.py Wed Mar 20 12:06:46 2024 -0400 +++ b/test/test_liveserver.py Wed Mar 20 17:13:30 2024 -0400 @@ -127,7 +127,9 @@ i18n.DOMAIN = cls.backup_domain def create_app(self): - '''The wsgi app to start - no feature_flags set.''' + '''The wsgi app to start - no feature_flags set. + Post 2.3.0 this enables the cache_tracker feature. + ''' if _py3: return validator(RequestDispatcher(self.dirname)) @@ -1215,13 +1217,13 @@ f = requests.get(self.url_base() + "?@search_text=RESULT") self.assertIn("foo bar", f.text) -class TestFeatureFlagCacheTrackerOn(BaseTestCases, WsgiSetup): +class TestFeatureFlagCacheTrackerOff(BaseTestCases, WsgiSetup): """Class to run all test in BaseTestCases with the cache_tracker - feature flag enabled when starting the wsgi server + feature flag disabled when starting the wsgi server """ def create_app(self): - '''The wsgi app to start with feature flag enabled''' - ff = { "cache_tracker": "" } + '''The wsgi app to start with feature flag disabled''' + ff = { "cache_tracker": False } if _py3: return validator(RequestDispatcher(self.dirname, feature_flags=ff)) else: @@ -1232,7 +1234,7 @@ @skip_postgresql class TestPostgresWsgiServer(BaseTestCases, WsgiSetup): """Class to run all test in BaseTestCases with the cache_tracker - feature flag enabled when starting the wsgi server + feature enabled when starting the wsgi server """ backend = 'postgresql'
