Skip to content

Commit 8481891

Browse files
committed
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.
1 parent 9488053 commit 8481891

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

CHANGES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ Features:
143143
machine parsible output. (John Rouillard)
144144
- Multiple JWT secrets are supported to allow key rotation. See
145145
an updated config.ini for details. (John Rouillard)
146-
146+
- issue2551212 - wsgi performance improvement feature added in 2.2.0
147+
is active by default. Can be turned off if needed. See upgrading.txt
148+
for info. (John Rouillard)
147149

148150
2023-07-13 2.3.0
149151

doc/upgrading.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ values or if a value must be changed manually.
112112

113113
This will insert the bad API login rate limiting settings.
114114

115+
Disable performance improvement for wsgi mode (optional)
116+
--------------------------------------------------------
117+
118+
In Roundup version 2.2.0 an experimental option to improve performance
119+
when running in wsgi mode was added. It as disabled at that time. In
120+
the last two years it has been in use at a few sits with no reports of
121+
issues.
122+
123+
So the default mode is now to enable this improvement. This will get
124+
more people using it. In case there is a latent bug that hasn't been
125+
discovered, it can still be disabled. To disable it, add the
126+
feature_flags to the RequestDispatcher as below:
127+
128+
feature_flags = { "cache_tracker": False }
129+
app = RequestDispatcher(tracker_home, feature_flags=feature_flags)
130+
131+
and restart your wsgi instance.
132+
115133
Fix duplicate id for confirm password in user.item.html (optional)
116134
------------------------------------------------------------------
117135

roundup/cgi/wsgi_handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def __init__(self, home, debug=False, timing=False, lang=None,
9898
else:
9999
self.translator = None
100100

101-
if "cache_tracker" in self.feature_flags:
101+
if "cache_tracker" not in self.feature_flags or \
102+
self.feature_flags["cache_tracker"] is not False:
102103
self.tracker = roundup.instance.open(self.home, not self.debug)
103104
else:
104105
self.preload()
@@ -133,7 +134,8 @@ def __call__(self, environ, start_response):
133134
else:
134135
form = BinaryFieldStorage(fp=environ['wsgi.input'], environ=environ)
135136

136-
if "cache_tracker" in self.feature_flags:
137+
if "cache_tracker" not in self.feature_flags or \
138+
self.feature_flags["cache_tracker"] is not False:
137139
client = self.tracker.Client(self.tracker, request, environ, form,
138140
self.translator)
139141
try:

test/test_liveserver.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ def teardown_class(cls):
127127
i18n.DOMAIN = cls.backup_domain
128128

129129
def create_app(self):
130-
'''The wsgi app to start - no feature_flags set.'''
130+
'''The wsgi app to start - no feature_flags set.
131+
Post 2.3.0 this enables the cache_tracker feature.
132+
'''
131133

132134
if _py3:
133135
return validator(RequestDispatcher(self.dirname))
@@ -1215,13 +1217,13 @@ def test_fts(self):
12151217
f = requests.get(self.url_base() + "?@search_text=RESULT")
12161218
self.assertIn("foo bar", f.text)
12171219

1218-
class TestFeatureFlagCacheTrackerOn(BaseTestCases, WsgiSetup):
1220+
class TestFeatureFlagCacheTrackerOff(BaseTestCases, WsgiSetup):
12191221
"""Class to run all test in BaseTestCases with the cache_tracker
1220-
feature flag enabled when starting the wsgi server
1222+
feature flag disabled when starting the wsgi server
12211223
"""
12221224
def create_app(self):
1223-
'''The wsgi app to start with feature flag enabled'''
1224-
ff = { "cache_tracker": "" }
1225+
'''The wsgi app to start with feature flag disabled'''
1226+
ff = { "cache_tracker": False }
12251227
if _py3:
12261228
return validator(RequestDispatcher(self.dirname, feature_flags=ff))
12271229
else:
@@ -1232,7 +1234,7 @@ def create_app(self):
12321234
@skip_postgresql
12331235
class TestPostgresWsgiServer(BaseTestCases, WsgiSetup):
12341236
"""Class to run all test in BaseTestCases with the cache_tracker
1235-
feature flag enabled when starting the wsgi server
1237+
feature enabled when starting the wsgi server
12361238
"""
12371239

12381240
backend = 'postgresql'

0 commit comments

Comments
 (0)