move main engine in worker

This commit is contained in:
rmanach
2023-04-18 12:57:43 +02:00
parent 64d91f4cbf
commit 4906b397ba
13 changed files with 103 additions and 139 deletions
+17 -6
View File
@@ -1,11 +1,10 @@
use crate::database::get_connection;
use std::time::Duration;
use std::{thread, time};
use super::{Runner, RunnerStatus, Storer};
use crate::error::StorerError;
#[derive(Debug)]
#[allow(dead_code)]
pub enum JobAction {
MegaportDeploy,
MegaportUndeploy,
@@ -40,16 +39,28 @@ impl Runner for Job {
match self.action {
JobAction::MegaportDeploy => {
println!("[job({:?})] deploying megaport...", self);
println!(
"[job({} - {:?} - {:?})] deploying megaport...",
self.id, self.action, self.status
);
}
JobAction::MegaportUndeploy => {
println!("[job({:?})] undeploying megaport...", self);
println!(
"[job({} - {:?} - {:?})] undeploying megaport...",
self.id, self.action, self.status
);
}
JobAction::MegaportCheckDeploy => {
println!("[job({:?})] ckecking megaport deployment...", self);
println!(
"[job({} - {:?} - {:?})] checking megaport deployement...",
self.id, self.action, self.status
);
}
JobAction::MegaportCheckUndeploy => {
println!("[job({:?})] ckecking megaport undeployment...", self);
println!(
"[job({} - {:?} - {:?})] checking megaport undeployement...",
self.id, self.action, self.status
);
}
}
+1
View File
@@ -1,6 +1,7 @@
use crate::error::StorerError;
#[derive(Debug)]
#[allow(dead_code)]
pub enum RunnerStatus {
Pending,
Running,