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 / power / p-private.h
Author[]Andy Green <andy@warmcat.com> 2026-04-04 04:25 UTC
Committer[]Andy Green <andy@warmcat.com> 2026-04-04 04:25 UTC
Tree6bf54a3bb565098494d2881b348aa8d0387f2f27   Raw Patch
 
sai-web: logs: create indexes
sai-web: logs: create indexes
diff --git a/src/common/c-sqlite3.c b/src/common/c-sqlite3.c index bf3d4a1..03d573a 100644 --- a/src/common/c-sqlite3.c +++ b/src/common/c-sqlite3.c @@ -73,6 +73,8 @@ sai_event_db_ensure_open(struct lws_context *cx, lws_dll2_owner_t *sqlite3_cache return 3; } + sai_sqlite3_statement(*ppdb, "CREATE UNIQUE INDEX IF NOT EXISTS idx_task_uuid ON tasks(uuid);", "create task index"); + sai_sqlite3_statement(*ppdb, "PRAGMA journal_mode=WAL;", "set WAL"); if (lws_struct_sq3_create_table(*ppdb, lsm_schema_sq3_map_log)) { @@ -81,12 +83,16 @@ sai_event_db_ensure_open(struct lws_context *cx, lws_dll2_owner_t *sqlite3_cache return 4; } + sai_sqlite3_statement(*ppdb, "CREATE INDEX IF NOT EXISTS idx_log_task_time ON logs(task_uuid, timestamp);", "create log index"); + if (lws_struct_sq3_create_table(*ppdb, lsm_schema_sq3_map_artifact)) { lwsl_err("%s: unable to create artifact table in %s\n", __func__, filepath); return 5; } + sai_sqlite3_statement(*ppdb, "CREATE INDEX IF NOT EXISTS idx_art_task ON artifacts(task_uuid);", "create artifact index"); + sc = malloc(sizeof(*sc)); memset(sc, 0, sizeof(*sc)); if (!sc) { diff --git a/src/server/s-comms.c b/src/server/s-comms.c index a1d20bb..a7ea272 100644 --- a/src/server/s-comms.c +++ b/src/server/s-comms.c @@ -198,6 +198,8 @@ s_callback_ws(struct lws *wsi, enum lws_callback_reasons reason, void *user, return -1; } + sai_sqlite3_statement(vhd->server.pdb, "CREATE UNIQUE INDEX IF NOT EXISTS idx_event_uuid ON events(uuid);", "create event index"); + if (lws_struct_sq3_create_table(vhd->server.pdb, lsm_schema_sq3_map_plat)) { lwsl_err("%s: unable to create builders table\n", __func__); diff --git a/src/web/w-comms.c b/src/web/w-comms.c index 7911db5..f8da1a6 100644 --- a/src/web/w-comms.c +++ b/src/web/w-comms.c @@ -183,6 +183,8 @@ w_callback_ws(struct lws *wsi, enum lws_callback_reasons reason, void *user, return -1; } + sai_sqlite3_statement(vhd->pdb, "CREATE UNIQUE INDEX IF NOT EXISTS idx_event_uuid ON events(uuid);", "create event index"); + /*
Page fetched 0s ago, creation time: 3ms (vhost etag hits: 0%, cache hits: 0%)