Skip to content
21 linesCodeBlameRaw
1//! Live repository pages: every event a repository page shows is passed to
2//! the notify service as a small change (`g1t_contracts::live`), which
3//! tells the people watching that repository's pages. One call per batch
4//! (more for a very busy one); nothing written in the repository goes
5//! along, and who may see it is notify's to keep: a tab watches a
6//! repository only after the site checked its person may read it.
7
8use g1t_contracts::events::Event;
9use g1t_contracts::live::{REPO_CHANGED, RepoChangedArgs, changes_of};
10use worker::{Fetcher, Result};
11
12/// Tells notify of the batch's changes. Logged and left when it cannot be
13/// reached: pages then catch up by themselves, and nothing else waits on it.
14pub(crate) async fn tell(notify: &Fetcher, events: &[Event]) {
15 for changes in changes_of(events) {
16 let told: Result<serde_json::Value> = g1t_kit::call(notify, REPO_CHANGED, &RepoChangedArgs { changes }).await;
17 if let Err(error) = told {
18 worker::console_error!("events: live pages not told: {error}");
19 }
20 }
21}