Commit c3cb07f
fix(loopback): set test_dummy_token before first HTTP request
The `circles:check` loopback test always fails with a 401 on the POST
request to `asyncBroadcast` with `test-dummy-token` when the config key
`test_dummy_token` does not already exist in the database.
Root cause: The GET request to `core.CSRFToken.index` (which runs first)
causes the web server process to load all `appconfig` values into its
APCu local cache (TTL=3s). Only then does the CLI process insert
`test_dummy_token` into the database and clear its own APCu cache — but
CLI and web server run in separate SAPI contexts with independent APCu
stores, so the web cache is unaffected. When the POST request arrives
shortly after the GET (well within the 3-second TTL), the web process
reads from its still-valid APCu cache, which does not contain the newly
inserted key. `getValueInt()` therefore returns the default `0`, and
`0 < time()` evaluates to true, causing the controller to return 401.
Moving `setValueInt()` before the GET request ensures the key exists in
the database before any web request loads the appconfig into APCu.
Signed-Off-By: Iva Horn <iva.horn@nextcloud.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 3faa4cd commit c3cb07f
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
259 | 261 | | |
260 | 262 | | |
261 | 263 | | |
262 | 264 | | |
263 | | - | |
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
| |||
0 commit comments