Skip to content

app/: the live listener survives its first probe (system clock, not Laravel's) - #152

Merged
ndbroadbent merged 1 commit into
mainfrom
app-live-listener-clock
Dec 3, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
app-live-listener-clock

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

After #149 deployed, /status read live_listener: stale and streams got their snapshot but no live changes. talira infra found the panic in the web pod's log at 22:20:35 UTC: thread 'tokio-rt-worker' panicked at app/src/live.rs:157:37: laravel::now() can only be used inside the application…. The listener's supervisor is a plain tokio::spawn task, outside the application, and it called laravel::now() when its first probe came back, so it died there, leaving its LISTEN connection open and unread (so stale, not can't-connect). It isn't a pooler: DATABASE_URL goes straight to CloudNativePG's -rw service.

Fix: both places the probe's bookkeeping read Laravel's clock (healthy() and the store after a successful probe) now use the file's own unix_seconds() (system clock), which the hub already used for its start time, so both sides of the comparison share one clock. The stream bodies were already safe: they read the database inside context.scope(...).

Test: live::tests::probe_health_needs_no_application_context, a plain unit test with no application, exercises healthy() and the probe store. Before the fix, healthy() panics there. The integration tests didn't catch it because they run with the application's context around them.

Checks (build pool): fmt, clippy -D warnings, the unit test, live_streams (12) and live_limits (1) pass.

After it deploys: /status should read live_listener: ok within a minute of a stream opening; then talira infra adds the Gatus check.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…(which panics outside the app and killed the listener)
@ndbroadbent
ndbroadbent force-pushed the app-live-listener-clock branch from 6396d09 to 2ed9d7d Compare December 3, 2026 22:37
@ndbroadbent
ndbroadbent merged commit 280614a into main Dec 3, 2026
14 checks passed
@ndbroadbent
ndbroadbent deleted the app-live-listener-clock branch December 3, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant