Andrey Antukh d608f3b898 🐛 Re-check websocket subscriptions on an interval
The announcement path is the primary mechanism, but it cannot see an
access change that fires no command here: Nitrate transferring the
ownership of an organization is an HTTP call to another service, and
rows deleted straight over SQL publish nothing. Both keep a
subscription alive until the connection happens to close.

Each relay now re-checks access every `subscription-revalidation-interval`
(5 minutes by default, overridable) and drops the subscription when it
no longer holds. The default is a code constant in `app.http.websocket`
rather than the `config.clj` default map, matching how session
lifetimes are configured.

The re-check is a scheduled task rather than a timer inside the relay
loop, on purpose: driven by the loop, a steady stream of edits would
push the check away forever and a busy file would never be re-checked
at all.

`start-relay` also replaces the `sp/pipe` of the team subscription and
the ad-hoc `go-loop` of the file one, so both now share the same
forwarding and re-check path.

`still-authorized?` is the one place that fails open: a transient
database error logs and keeps the subscription rather than kicking a
user out of an editor, and the next tick tries again.

Closes #12155

AI-assisted-by: space-bunny-free
2026-10-08 13:08:50 +02:00
..
2026-09-29 09:07:34 +02:00
2026-10-06 15:12:15 +02:00
2026-10-06 15:12:15 +02:00
2024-05-29 19:05:04 +02:00