Skip to main content

watch_events

Function watch_events 

Source
pub async fn watch_events(pool: PgPool, wake: Arc<Sender<u64>>)
Expand description

Turn database notifications into wake-ups, until the daemon stops.

The published value is a counter, not a watermark: subscriptions re-read from their own cursors anyway, so all this has to carry is “something changed”. A counter is always different from the last one, which means a receiver can never mistake two appends for one.

A listener that cannot connect or that dies is not fatal, and deliberately so — it degrades a subscription from milliseconds to SUBSCRIPTION_POLL_SECS, and a kernel that refused to serve at all because its notification channel was unavailable would be trading a slower stream for no stream.