impl subscriber

This commit is contained in:
rmanach
2023-04-18 20:55:38 +02:00
parent abfae5babb
commit 0c3a8acae0
5 changed files with 86 additions and 15 deletions
+20 -1
View File
@@ -48,6 +48,25 @@ impl Job {
Ok(Message::check_deploy(self.id.try_into().unwrap(), ""))
}
fn check_megaport(&mut self) -> Result<Message, String> {
self.set_status(RunnerStatus::Running);
println!(
"[job({} - {:?} - {:?})] checking megaport...",
self.id, self.action, self.status
);
let wait = time::Duration::from_millis(50);
thread::sleep(wait);
self.set_status(RunnerStatus::Success);
println!(
"[job({} - {:?} - {:?})] checking megaport done",
self.id, self.action, self.status
);
Ok(Message::check_deploy(self.id.try_into().unwrap(), ""))
}
fn set_status(&mut self, status: RunnerStatus) {
self.status = status;
}
@@ -58,7 +77,7 @@ impl Runner for Job {
match self.action {
JobAction::MegaportDeploy => self.deploy_megaport(),
JobAction::MegaportUndeploy => todo!(),
JobAction::MegaportCheckDeploy => todo!(),
JobAction::MegaportCheckDeploy => self.check_megaport(),
JobAction::MegaportCheckUndeploy => todo!(),
}
}