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 / src / web / CMakeLists.txt
Author[]Andy Green <andy@warmcat.com> 2026-07-19 07:59 UTC
Committer[]Andy Green <andy@warmcat.com> 2026-07-19 08:00 UTC
Treefe888842f8249bad3597624739c926c21a9f39f7   Raw Patch
 
builder: fix deletion scheduling
builder: fix deletion scheduling
diff --git a/src/builder/b-deletion.c b/src/builder/b-deletion.c index 97c4d9e..42cc7ea 100644 --- a/src/builder/b-deletion.c +++ b/src/builder/b-deletion.c @@ -80,6 +80,9 @@ sai_rm_rf_cb(const char *dirpath, void *user, struct lws_dir_entry *lde) if (lde->type == LDOT_DIR) { lws_dir(path, user, sai_rm_rf_cb); +#if defined(WIN32) + SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL); +#endif if (rmdir(path)) lwsl_notice("%s: rmdir %s failed: errno %d (%s)\n", __func__, path, errno, strerror(errno)); } else { @@ -125,6 +128,11 @@ child_lejp_cb(struct lejp_ctx *ctx, char reason) lws_dir_via_info(&di); /* lws_dir_via_info returns 1 on success. Errors are logged by sai_rm_rf_cb. */ +#if defined(WIN32) + SetFileAttributesA(full_path, FILE_ATTRIBUTE_NORMAL); +#endif + rmdir(full_path); + if (!stat(full_path, &st)) lwsl_notice("%s: top level dir %s still exists\n", __func__, full_path); } else { diff --git a/src/builder/b-nspawn.c b/src/builder/b-nspawn.c index 26def3c..56c9ed9 100644 --- a/src/builder/b-nspawn.c +++ b/src/builder/b-nspawn.c @@ -117,16 +117,10 @@ callback_sai_stdwsi(struct lws *wsi, enum lws_callback_reasons reason, #if defined(WIN32) case LWS_CALLBACK_RAW_ADOPT_FILE: - lwsl_user("%s: wsi %p, reason %d, op %p, fd %d\n", __func__, - wsi, reason, op, lws_spawn_get_stdfd(wsi)); break; #endif case LWS_CALLBACK_RAW_CLOSE_FILE: -#if defined(WIN32) - lwsl_user("%s: wsi %p, CLOSE_FILE, op %p, fd %d\n", __func__, - wsi, op, lws_spawn_get_stdfd(wsi)); -#endif { int ch = lws_spawn_get_stdfd(wsi); if (ch == 0) ch = 1; @@ -152,7 +146,6 @@ callback_sai_stdwsi(struct lws *wsi, enum lws_callback_reasons reason, if (GetLastError() != 109 && GetLastError() != 232) lwsl_user("%s: read on stdwsi failed, err %lu\n", __func__, GetLastError()); return -1; } - lwsl_user("%s: WIN32 RX_FILE read %lu bytes on fd %d\n", __func__, rb, lws_spawn_get_stdfd(wsi)); ilen = (int)rb; } #else diff --git a/src/builder/b-private.h b/src/builder/b-private.h index 8ee836b..836d1cc 100644 --- a/src/builder/b-private.h +++ b/src/builder/b-private.h @@ -79,7 +79,7 @@ struct saib_opaque_spawn { #define SAI_LOAD_REPORT_US (1 * LWS_US_PER_SEC) #define SAI_IDLE_GRACE_US (builder.one_shot_active ? (10 * LWS_US_PER_SEC) : (30 * LWS_US_PER_SEC)) #define SAI_STAY_POLL_US (20 * LWS_US_PER_SEC) -#define SAI_CLEANUP_JOBS_INTERVAL_US (60 * 60 * LWS_US_PER_SEC) +#define SAI_CLEANUP_JOBS_INTERVAL_US (60ULL * 60ULL * LWS_US_PER_SEC) #define SAI_CLEANUP_JOB_DIR_MIN_AGE_SECS (24ull * 3600u) diff --git a/src/builder/b-task.c b/src/builder/b-task.c index 6ef1402..7b21222 100644 --- a/src/builder/b-task.c +++ b/src/builder/b-task.c @@ -146,7 +146,10 @@ const char *git_helper_bat = " echo \"BUILD_DIR: !BUILD_DIR!\"\n" " echo \"HASH: !HASH!\"\n" " if not exist \"!BUILD_DIR!\\\\.git\" (\n" - " if exist \"!BUILD_DIR!\\\\\" rmdir /s /q \"!BUILD_DIR!\"\n" + " if exist \"!BUILD_DIR!\\\\\" (\n" + " del /f /s /q \"!BUILD_DIR!\" > nul 2>&1\n" + " rmdir /s /q \"!BUILD_DIR!\"\n" + " )\n" " mkdir \"!BUILD_DIR!\"\n" " git -C \"!BUILD_DIR!\" init\n" " if errorlevel 1 exit /b 1\n" @@ -155,6 +158,7 @@ const char *git_helper_bat = " if errorlevel 1 exit /b 2\n" " git -C \"!BUILD_DIR!\" checkout -f \"!HASH!\"\n" " if errorlevel 1 exit /b 1\n" + " git -C \"!BUILD_DIR!\" clean -fdx\n" " echo \">>> Git helper script finished.\"\n" " exit /b 0\n" ")\n" diff --git a/src/server/s-task-helpers.c b/src/server/s-task-helpers.c index 01f38b9..91319a4 100644 --- a/src/server/s-task-helpers.c +++ b/src/server/s-task-helpers.c @@ -585,14 +585,14 @@ sais_task_clear_build_and_logs(struct vhd *vhd, const char *task_uuid, int from_ t->builder[0] = '\0'; t->builder_name[0] = '\0'; t->server_name = ""; + t->state = -1; /* serialize as a new row */ lws_struct_sq3_serialize(pdb, lsm_schema_sq3_map_task, &o, 0); } else { - t->state = SAIES_WAITING; /* update the existing row if it's a rejection */ lws_snprintf(cmd, sizeof(cmd), "update tasks set state=%d,started=0,duration=0,build_step=0 where uuid='%s' and run=%d", - SAIES_WAITING, esc, t->run); + -1, esc, t->run); sqlite3_exec(pdb, cmd, NULL, NULL, NULL); } } @@ -600,14 +600,7 @@ sais_task_clear_build_and_logs(struct vhd *vhd, const char *task_uuid, int from_ lwsac_free(&ac); sai_event_db_close(&vhd->sqlite3_cache, &pdb); - if (!from_rejection) { - sais_set_task_state(vhd, task_uuid, SAIES_WAITING, 0, 0); - sais_taskchange(vhd->h_ss_websrv, task_uuid, SAIES_WAITING); - sais_eventchange(vhd->h_ss_websrv, event_uuid, SAIES_WAITING); - } else { - sais_taskchange(vhd->h_ss_websrv, task_uuid, SAIES_WAITING); - sais_eventchange(vhd->h_ss_websrv, event_uuid, SAIES_WAITING); - } + sais_set_task_state(vhd, task_uuid, SAIES_WAITING, 0, 0); sais_task_stop_on_builders(vhd, task_uuid); @@ -668,14 +661,12 @@ sais_task_remove_all_tries(struct vhd *vhd, const char *task_uuid) lws_snprintf(cmd, sizeof(cmd), "update tasks set state=%d,started=0,duration=0,build_step=0,builder_name='',builder='',server_name='' where uuid='%s' and run=0", - SAIES_WAITING, esc); + -1, esc); sqlite3_exec(pdb, cmd, NULL, NULL, NULL); sai_event_db_close(&vhd->sqlite3_cache, &pdb); sais_set_task_state(vhd, task_uuid, SAIES_WAITING, 0, 0); - sais_taskchange(vhd->h_ss_websrv, task_uuid, SAIES_WAITING); - sais_eventchange(vhd->h_ss_websrv, event_uuid, SAIES_WAITING); lwsl_notice("%s: scheduling sul_central to find a new task\n", __func__); lws_sul_schedule(vhd->context, 0, &vhd->sul_central, sais_central_cb, 1);
Page fetched 0s ago, creation time: 3ms (vhost etag hits: 0%, cache hits: 0%)