You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(apps): cache generation leases in the app manager #657
Every app UI request pays several database round trips for lease checks.
lease::check (core/src/app_ipc/lease.rs:15-30) has no cache. Each call goes to lease_expires_at (core/src/app_ipc/gateway.rs:161-191) and runs one Postgres transaction in the web process (web/src/server/AppRuntime/management.server.ts:89-98).
A static UI asset costs 3 transactions: authorizeAppUi (web/src/server/AppRuntime/ui/assets.server.ts:117) plus two check_live calls (core/src/app_manager/ui.rs:270, :286). Assets are no-store, so every frame open repeats this per file.
A /__app-ui/call costs 6 (7 when the app answers 409): session, metadata check_live, policy check_live, pre-authorize, broker require_lease (gateway.rs:351), post-authorize.
check_live (ui.rs:495-513) has a 3 s timeout and runs outside the per-installation operation limit. The web UI socket has 16 slots shared by all apps (ui.rs:47, :197-201). A stalled broker therefore makes each of its requests wait about 3 s while holding a shared slot, which slows the UI of other apps.
Proposal
Keep the last confirmed lease expiry per generation in the app manager (monotonic clock), and invalidate it synchronously on close, stop and retire. Only call the platform when the cached lease is about to expire.
Check liveness once per asset request instead of twice, and run it under the per-installation limit.
Give a stalled broker its own budget so it cannot hold the shared web UI socket slots.
Acceptance
Test: opening a frame with N assets causes at most one lease round trip while the lease is valid.
Test: a stalled app's broker does not delay asset requests of another app beyond a small bound.
Revocation still takes effect immediately on stop and retire.
Activity