summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-06-29 02:25:11 -0700
committeriximeow <me@iximeow.net>2023-06-29 02:25:11 -0700
commit1589853ea765f5512ea776a74535d6022812e289 (patch)
tree9fc06f13bc0b4e8d6615cd90821b00563f1b735f
parent300098949689c2da294476483e8565e8b481e8ac (diff)
started->active, include pending
-rw-r--r--src/dbctx.rs4
-rw-r--r--src/main.rs2
-rw-r--r--src/sql.rs4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/dbctx.rs b/src/dbctx.rs
index a646c19..dcca362 100644
--- a/src/dbctx.rs
+++ b/src/dbctx.rs
@@ -458,10 +458,10 @@ impl DbCtx {
Ok(jobs)
}
- pub fn get_started_jobs(&self) -> Result<Vec<Job>, String> {
+ pub fn get_active_jobs(&self) -> Result<Vec<Job>, String> {
let conn = self.conn.lock().unwrap();
- let mut started_query = conn.prepare(sql::STARTED_JOBS).unwrap();
+ let mut started_query = conn.prepare(sql::ACTIVE_JOBS).unwrap();
let mut jobs = started_query.query([]).unwrap();
let mut started = Vec::new();
diff --git a/src/main.rs b/src/main.rs
index ddd263c..5f719a0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -403,7 +403,7 @@ async fn handle_ci_index(State(ctx): State<WebserverState>) -> impl IntoResponse
response.push_str("<h4>active jobs</h4>\n");
- let jobs = ctx.dbctx.get_started_jobs().expect("can query");
+ let jobs = ctx.dbctx.get_active_jobs().expect("can query");
if jobs.len() == 0 {
response.push_str("<p>(none)</p>\n");
} else {
diff --git a/src/sql.rs b/src/sql.rs
index 96d2ef8..91edafb 100644
--- a/src/sql.rs
+++ b/src/sql.rs
@@ -97,8 +97,8 @@ pub const CREATE_REPO_NAME_INDEX: &'static str = "\
pub const PENDING_JOBS: &'static str = "\
select id, artifacts_path, state, run_host, remote_id, commit_id, created_time, source from jobs where state=0;";
-pub const STARTED_JOBS: &'static str = "\
- select * from jobs where state=1;";
+pub const ACTIVE_JOBS: &'static str = "\
+ select * from jobs where state=1 or state=0;";
pub const LAST_ARTIFACTS_FOR_JOB: &'static str = "\
select * from artifacts where job_id=?1 and (name like \"%(stderr)%\" or name like \"%(stdout)%\") order by id desc limit ?2;";