Overhaul runner protocol
The JSON should now be nicer to work with.
This commit is contained in:
parent
b16b3a668e
commit
7911a67906
4 changed files with 42 additions and 25 deletions
|
|
@ -67,7 +67,7 @@ async fn post_status(
|
|||
// Find new work
|
||||
let work = if let Some(hash) = work {
|
||||
let bench = match bench_repo {
|
||||
Some(bench_repo) => BenchMethod::BenchRepo {
|
||||
Some(bench_repo) => BenchMethod::Repo {
|
||||
hash: bench_repo.0.to_thread_local().head_id()?.to_string(),
|
||||
},
|
||||
None => BenchMethod::Internal,
|
||||
|
|
|
|||
|
|
@ -64,12 +64,12 @@ async fn get_runners(
|
|||
let status = match &info.status {
|
||||
RunnerStatus::Idle => Status::Idle,
|
||||
RunnerStatus::Busy => Status::Busy,
|
||||
RunnerStatus::Working { id, hash, .. } => {
|
||||
RunnerStatus::Working(run) => {
|
||||
let message =
|
||||
sqlx::query_scalar!("SELECT message FROM commits WHERE hash = ?", hash)
|
||||
sqlx::query_scalar!("SELECT message FROM commits WHERE hash = ?", run.hash)
|
||||
.fetch_one(db)
|
||||
.await?;
|
||||
Status::Working(RunLink::new(base, id.clone(), hash, &message))
|
||||
Status::Working(RunLink::new(base, run.id.clone(), &run.hash, &message))
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -89,9 +89,9 @@ async fn get_queue(
|
|||
// Group runners by commit hash
|
||||
let mut runners_by_commit: HashMap<String, Vec<RunnerLink>> = HashMap::new();
|
||||
for (name, info) in runners {
|
||||
if let RunnerStatus::Working { hash, .. } = &info.status {
|
||||
if let RunnerStatus::Working(run) = &info.status {
|
||||
runners_by_commit
|
||||
.entry(hash.clone())
|
||||
.entry(run.hash.clone())
|
||||
.or_default()
|
||||
.push(RunnerLink::new(base, name.clone()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue