|
|
|
@ -121,3 +121,39 @@ impl IRequest for CancelSectionRunIdRequest {
@@ -121,3 +121,39 @@ impl IRequest for CancelSectionRunIdRequest {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[derive(Debug, Deserialize, Serialize)] |
|
|
|
|
#[serde(rename_all = "camelCase")] |
|
|
|
|
pub struct PauseSectionRunnerRequest { |
|
|
|
|
pub paused: bool, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[derive(Debug, Deserialize, Serialize)] |
|
|
|
|
#[serde(rename_all = "camelCase")] |
|
|
|
|
pub struct PauseSectionRunnerResponse { |
|
|
|
|
pub message: String, |
|
|
|
|
pub paused: bool, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl IRequest for PauseSectionRunnerRequest { |
|
|
|
|
type Response = PauseSectionRunnerResponse; |
|
|
|
|
fn exec(&mut self, ctx: &mut RequestContext) -> RequestFuture<Self::Response> { |
|
|
|
|
let mut section_runner = ctx.section_runner.clone(); |
|
|
|
|
let paused = self.paused; |
|
|
|
|
Box::pin(async move { |
|
|
|
|
if paused { |
|
|
|
|
section_runner.pause().await |
|
|
|
|
} else { |
|
|
|
|
section_runner.unpause().await |
|
|
|
|
} |
|
|
|
|
.wrap_err("could not pause/unpause section runner")?; |
|
|
|
|
Ok(PauseSectionRunnerResponse { |
|
|
|
|
message: format!( |
|
|
|
|
"{} section runner", |
|
|
|
|
if paused { "paused" } else { "unpaused" } |
|
|
|
|
), |
|
|
|
|
paused, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|