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 / scripts / sai-web.service
Author[]Andy Green <andy@warmcat.com> 2020-10-23 13:45 UTC
Committer[]Andy Green <andy@warmcat.com> 2020-10-23 13:45 UTC
Treef68d2e91b6d18d58ac4ec652f6a66908c338034a   Raw Patch
 
align-with-libwebsockets-org-version
align-with-libwebsockets-org-version
diff --git a/assets/sai.js b/assets/sai.js index a727411..8900d1b 100644 --- a/assets/sai.js +++ b/assets/sai.js @@ -562,7 +562,7 @@ function sai_taskinfo_render(t, now_ut) s = "<div class=\"taskinfo\"><table><tr class=\"nomar\"><td class=\"atop\"><table>" + sai_event_render(t, now_ut, 0) + "</table></td><td class=\"ti\">" + - "<span class=\"taskstate" + t.t.state + " ti1\">" + sai_plat_icon(t.t.platform, 2) + + "<span class=\"ti1\">" + sai_plat_icon(t.t.platform, 2) + san(t.t.platform) + "</span>&nbsp;"; if (authd && t.t.state != 0 && t.t.state != 3 && t.t.state != 4 && t.t.state != 5) s += "<img class=\"rebuild\" alt=\"stop build\" src=\"stop.svg\" " + @@ -863,8 +863,8 @@ function ws_open_sai() } var s1 = get_appropriate_ws_url() + "/sai/browse" + s; - if (s1.split("?")) - s1 = s1.split("?")[0]; +// if (s1.split("?")) +// s1 = s1.split("?")[0]; console.log(s1); sai = new WebSocket(s1, "com-warmcat-sai"); diff --git a/src/master/m-comms.c b/src/master/m-comms.c index b7780b1..de18157 100644 --- a/src/master/m-comms.c +++ b/src/master/m-comms.c @@ -1047,11 +1047,9 @@ clean_spa: memcpy(pss->specific, "refs/heads/", 11); pss->specificity = SAIM_SPECIFIC_H; } else - if (lws_get_urlarg_by_name(wsi, "id", - (char *)buf, + if (lws_get_urlarg_by_name(wsi, "id", (char *)buf, sizeof(buf))) { - lws_strncpy(pss->specific, - (const char *)buf + 3, + lws_strncpy(pss->specific, (const char *)buf + 3, sizeof(pss->specific)); pss->specificity = SAIM_SPECIFIC_ID; } else { @@ -1060,8 +1058,9 @@ clean_spa: "refs/heads/master", sizeof(pss->specific)); } - lwsl_info("%s: spec %d, '%s'\n", __func__, - pss->specificity, pss->specific); + + //lwsl_notice("%s: spec %d, '%s'\n", __func__, + // pss->specificity, pss->specific); break; } diff --git a/src/master/m-notification.c b/src/master/m-notification.c index 2412054..207e097 100644 --- a/src/master/m-notification.c +++ b/src/master/m-notification.c @@ -828,6 +828,8 @@ sai_notification_file_upload_cb(void *data, const char *name, return m; } + lwsl_notice("%s: m = %d\n", __func__, m); + if (m != 1) break; @@ -841,6 +843,34 @@ sai_notification_file_upload_cb(void *data, const char *name, } lwsl_notice("%s: hmac OK\n", __func__); + /* + * We have the notification metadata JSON parsed into pss->sn.e, + * eg, pss->sn->e.hash ... since it's common to, eg, push a tree + * in a branch and then later tag the same commit, we don't want + * to pointlessly repeat CI for the same tree multiple times, + * and need to basically dedupe. + */ + + { + uint64_t rid = 0; + char qu[192]; + + lws_snprintf(qu, sizeof(qu), "select rowid from events " + "where hash='%s'", + pss->sn.e.hash); + + if (sqlite3_exec(pss->vhd->master.pdb, qu, + sai_sql3_get_uint64_cb, + &rid, NULL) == SQLITE_OK && rid) { + /* it already exists */ + lwsl_notice("%s: ignoring notification as " + "tree hash event exists\n", + __func__); + + return 0; + } + } + if (!pss->sn.saifile) return -1; diff --git a/src/master/m-ws-browser.c b/src/master/m-ws-browser.c index dab9256..58f0e3f 100644 --- a/src/master/m-ws-browser.c +++ b/src/master/m-ws-browser.c @@ -779,15 +779,22 @@ again: e = lws_container_of(pss->walk, sai_event_t, list); if (pss->specificity) { - lwsl_info("%s: specificity: e->hash: %s, e->ref: %s, pss->specific: %s\n", - __func__, e->hash, e->ref, pss->specific); - if (strcmp(e->hash, pss->specific) && - strcmp(e->ref, pss->specific)) { - pss->walk = pss->walk->next; - continue; + lwsl_notice("%s: Specificity: e->hash: %s, e->ref: '%s', pss->specific: '%s'\n", + __func__, e->hash, e->ref, pss->specific); + + if (!strcmp(pss->specific, "refs/heads/master") && !strcmp(e->ref, "refs/heads/main")) { + lwsl_notice("master->main\n"); + any = 1; + } else { + + if (strcmp(e->hash, pss->specific) && + strcmp(e->ref, pss->specific)) { + pss->walk = pss->walk->next; + continue; + } + //lwsl_notice("%s: match\n", __func__); + any = 1; } - //lwsl_notice("%s: match\n", __func__); - any = 1; } js = lws_struct_json_serialize_create(
Page fetched 0s ago, creation time: 5ms (vhost etag hits: 0%, cache hits: 0%)