Repository navigation
fix(realtime): wait for permission checks as long as the API database timeout - #15169
Conversation
… timeout Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
This PR retires the realtime permission-verification timeout tuning knob and derives the timeout from the existing database query timeout instead.
Reviewed commit: 1ae94ea |
New ConsoleProject ID: Tip Silent mode disables those chatty PR comments if you prefer peace and quiet |
🟢 Tier S · Ready to mergeRealtime permission verification now uses the API database timeout, and realtime database handles apply that same timeout to their queries. The obsolete realtime-specific permission timeout setting is removed from the variable catalog and compose configuration.
📂 Walkthrough · 4
Reviewed |
commit: |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|

Issue / Description
Part of appwrite-labs/cloud#7177.
The bounded wait in
Handler::verify()(#15086) used its own setting,_APP_REALTIME_PERMISSION_TIMEOUT(default 5 s). That number was unrelated to how long the database lets the check's query run:DatabaseFactorydefaults to0), so an abandoned query could run unbounded in the background.The time worth waiting is exactly how long the database is allowed to answer, which for request-time work is the API limit.
Solution
verify()now waitsAPP_DATABASE_TIMEOUT_MILLISECONDS_API / 1000seconds (15 s), the same limit an API request gives a query.getConsoleDB()andgetProjectDB()now setAPP_DATABASE_TIMEOUT_MILLISECONDS_APIon their database handles. The query is then killed when the wait ends, instead of running on unbounded. Cloud does the same in appwrite-labs/cloud#7181._APP_REALTIME_PERMISSION_TIMEOUTis removed fromapp/realtime.php,app/config/variables.php,docker-compose.ymland the console compose generator. Neither the cloud nor the infrastructure repo sets it.Trade-off: a hung check can now hold the subscriber loop for up to 15 s instead of 5 s before it fails closed. Exceptions and coroutine-limit failures still fail closed immediately.
Tests
tests/unit/Realtime,tests/unit/Docker(compose generator) andtests/unit/Platform/Modules/Installer: 262 tests pass.php -l app/realtime.phpis clean.🤖 Generated with Claude Code