Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / READMEs / README-gitolite-hook.md
Author[]Andy Green <andy@warmcat.com> 2026-07-12 03:15 UTC
Committer[]Andy Green <andy@warmcat.com> 2026-07-14 12:56 UTC
Tree77d28267c075c99d7c0f5a7d1c2406b964e42b71   Raw Patch
 
message optimization
message optimization
diff --git a/assets/sai.js b/assets/sai.js index 60079f4..433965e 100644 --- a/assets/sai.js +++ b/assets/sai.js @@ -1110,7 +1110,7 @@ function sai_taskinfo_render(t, now_ut) sai_arts = ""; } - if (t.runs && t.runs.length > 0) { + if (t.runs && t.runs.length >= 2) { var r1 = "", r2 = ""; s += "<div class=\"runs-header-container\"><table class=\"runs-table\"><tr>"; for (var n = t.runs.length - 1; n >= 0; n--) { @@ -1607,6 +1607,8 @@ function selectEvent(uuid) { if (ev_obj) { render_selected_event_tasks(ev_obj); + /* Notify server of the selected event so it can throttle task state broadcasts */ + sai.send("{\"schema\":\"com.warmcat.sai.eventinfo\", \"js_api_version\": " + SAI_JS_API_VERSION + ", \"event_hash\": " + JSON.stringify(uuid) + "}"); } } @@ -2835,6 +2837,8 @@ function ws_open_sai() } } + var old_latest_uuid = loaded_events.length ? loaded_events[loaded_events.length - 1].e.uuid : null; + if (jso.overview) { jso.overview.forEach(function(new_ev) { var idx = loaded_events.findIndex(o => o.e.uuid === new_ev.e.uuid); @@ -2864,10 +2868,16 @@ function ws_open_sai() } render_event_decals(); - if (selected_event_uuid) { - var ev_obj = loaded_events.find(o => o.e.uuid === selected_event_uuid); - if (ev_obj) { - render_selected_event_tasks(ev_obj); + var new_latest_uuid = loaded_events.length ? loaded_events[loaded_events.length - 1].e.uuid : null; + if (old_latest_uuid && new_latest_uuid !== old_latest_uuid) { + /* A new event arrived! Select it and clear logs. */ + selectEvent(new_latest_uuid); + } else { + if (selected_event_uuid) { + var ev_obj = loaded_events.find(o => o.e.uuid === selected_event_uuid); + if (ev_obj) { + render_selected_event_tasks(ev_obj); + } } } diff --git a/src/builder/b-nspawn.c b/src/builder/b-nspawn.c index 1343af6..26def3c 100644 --- a/src/builder/b-nspawn.c +++ b/src/builder/b-nspawn.c @@ -666,7 +666,7 @@ saib_spawn_script(struct sai_nspawn *ns) info.exec_array = cmd; info.protocol_name = "sai-stdxxx"; info.max_log_lines = 10000; - info.timeout_us = (uint64_t)builder.build_timeout_secs * LWS_US_PER_SEC; + info.timeout_us = (lws_usec_t)((uint64_t)builder.build_timeout_secs * LWS_US_PER_SEC); info.reap_cb = sai_lsp_reap_cb; #if defined(WIN32) info.pty_mode = 0; @@ -864,7 +864,7 @@ saib_shell_spawn(struct sai_plat_server *spm, const char *task_uuid) info.exec_array = cmd; info.protocol_name = "sai-saishell"; info.max_log_lines = 10000; - info.timeout_us = (uint64_t)builder.build_timeout_secs * LWS_US_PER_SEC; + info.timeout_us = (lws_usec_t)((uint64_t)builder.build_timeout_secs * LWS_US_PER_SEC); info.reap_cb = sai_shell_reap_cb; info.pty_mode = 1; info.disable_ctrlc = 0; diff --git a/src/web/w-comms.c b/src/web/w-comms.c index e08150e..d0523c7 100644 --- a/src/web/w-comms.c +++ b/src/web/w-comms.c @@ -574,6 +574,7 @@ http_resp: lwsl_info("%s: '%s'\n", __func__, tbuf); if (!strncmp(tbuf, "task=", 5)) { lws_strncpy(pss->specific_task, tbuf + 5, sizeof(pss->specific_task)); + sai_task_uuid_to_event_uuid(pss->selected_event_uuid, pss->specific_task); pss->specificity = SAIM_SPECIFIC_TASK; saiw_broadcast_logs_batch(vhd, pss); } diff --git a/src/web/w-private.h b/src/web/w-private.h index 38470a9..831d910 100644 --- a/src/web/w-private.h +++ b/src/web/w-private.h @@ -85,6 +85,7 @@ struct pss { char specific_ref[65]; char specific_task[65]; char specific_project[96]; + char selected_event_uuid[33]; sqlite3 *pdb_artifact; sqlite3_blob *blob_artifact; diff --git a/src/web/w-ws-browser.c b/src/web/w-ws-browser.c index 7652b62..430d2b3 100644 --- a/src/web/w-ws-browser.c +++ b/src/web/w-ws-browser.c @@ -587,10 +587,16 @@ saiw_subs_task_state_change(struct vhd *vhd, const char *task_uuid) int saiw_browsers_task_state_change(struct vhd *vhd, const char *task_uuid) { + char event_uuid[33]; + + sai_task_uuid_to_event_uuid(event_uuid, task_uuid); + lws_start_foreach_dll(struct lws_dll2 *, p, vhd->browsers.head) { struct pss *pss = lws_container_of(p, struct pss, same); - if (!pss->is_gitohashi) + if (!pss->is_gitohashi && + (!pss->selected_event_uuid[0] || + !strcmp(pss->selected_event_uuid, event_uuid))) saiw_pss_schedule_taskinfo(pss, task_uuid, 0, -1); } lws_end_foreach_dll(p); @@ -726,6 +732,8 @@ saiw_ws_json_rx_browser(struct vhd *vhd, struct pss *pss, uint8_t *buf, ei = (sai_browse_rx_evinfo_t *)a.dest; + lws_strncpy(pss->selected_event_uuid, ei->event_hash, sizeof(pss->selected_event_uuid)); + if (saiw_pss_schedule_eventinfo(pss, ei->event_hash)) goto soft_error;
Page fetched 0s ago, creation time: 21ms (vhost etag hits: 0%, cache hits: 0%)