rustploy 0.1.22

Rustploy PaaS daemon — lightweight self-hosted deployment platform
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! `Command::JobWarmStatus`: se as imagens e o cache de build de um job já estão
//! no host — a fonte única da verdade que as telas exibem (`jobs::warm::status`).

use crate::bootstrap::state::AppState;
use shared::Response as RpResponse;

pub async fn handle(state: AppState, job_id: String) -> RpResponse {
    let job = match crate::store::job::get(&state.db, &job_id).await {
        Ok(Some(j)) => j,
        Ok(None) => return RpResponse::err("NotFound", "job not found"),
        Err(e) => return RpResponse::err("DatabaseError", e.to_string()),
    };
    RpResponse::JobWarmStatus(crate::features::jobs::warm::status(&state.jobs_ctx(), &job).await)
}