High-traffic mode keeps turning itself off. Ilya asked whether deploys were doing it. I read the v3 code (main at 0f424560) and it's probably not the deploy. Below is what I found, so the next session can pick up from here.
Where the setting lives
state/high_traffic/<hash>/state.jsonholdsenabled,reasonandchanged_at. Git doesn't track it.Serving also needs the
public/.high-trafficsymlink, which points at the cache'spages/directory.public/.htaccessalso has to start with the# BEGIN V3 HIGH TRAFFICblock.HighTrafficMode::status()reportseffective_mode: high-trafficonly when all three line up.
Deploys (unlikely)
Deploy/AppUpdate.php stashes local edits, fast-forwards, and re-applies the stash. If re-applying would conflict, the deploy is refused and nothing changes. So the Tools -> Deploy path keeps the .htaccess block. The block could still be lost by a manual SSH git stash pop that conflicts and gets resolved toward upstream, or by git checkout public/.htaccess. A schema change also doesn't turn the mode off. It only makes refreshes fail until someone runs ./v3 high-traffic prepare.
What actually turns it off
Explicit withdraw in
HighTrafficSafety::beforeWrite. Any of these setsenabled=false, removes the symlink, and records the reason "Content/access change; operator may re-enable after review.":feature-flag writes
approval writes
content imports (
ContentImportRunner)thread labels or reactions tagged flag, identity or internal
Silent detach in
StaticArtifactInvalidator::invalidateAllGeneratedPresentationandinvalidateRemovedPost. These remove the symlink and leavestate.jsonsayingenabled: true. Status then shows enabled next toeffective_mode: normal, so it looks like a mystery reset, and nothing turns it back on. Callers:every username change (
LocalWriteServicearound line 1635)post retractions and removals
HistoryPurgeSourceLabelRemovalreaction recovery (
recoverReactionDerivedState,recoverSignedReactionWrites)
My bet is #2. Username changes alone happen often enough to explain it.
Next step: check the server
cd ~/v3 && ./v3 high-traffic status
cat state/high_traffic/*/state.json; echo
ls -la public/.high-traffic; head -1 public/.htaccess
If it shows
enabled:falsewith the content/access reason, it's #1. Matchchanged_atagainst flag, approval or import activity.If it shows
enabled:truewith no symlink, it's #2.If the first line of
.htaccessisn't the BEGIN marker, the git side did it after all.
Proposed fix for #2
When the invalidator detaches the link, also write enabled=false and a reason to state.json, so status tells the truth. Better still, re-attach the link once the affected pages are re-rendered, so routine actions like username changes don't leave the mode off. Not started yet.