mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
replace todo with actual notify call
This commit is contained in:
committed by
Aiden McClelland
parent
59e1c76bc0
commit
d24f20cc87
@@ -13,6 +13,7 @@ use crate::context::RpcContext;
|
|||||||
use crate::db::model::CurrentDependencyInfo;
|
use crate::db::model::CurrentDependencyInfo;
|
||||||
use crate::dependencies::DependencyError;
|
use crate::dependencies::DependencyError;
|
||||||
use crate::manager::{Manager, Status as ManagerStatus};
|
use crate::manager::{Manager, Status as ManagerStatus};
|
||||||
|
use crate::notifications::{notify, NotificationLevel, NotificationSubtype};
|
||||||
use crate::s9pk::manifest::{Manifest, PackageId};
|
use crate::s9pk::manifest::{Manifest, PackageId};
|
||||||
use crate::status::health_check::HealthCheckResultVariant;
|
use crate::status::health_check::HealthCheckResultVariant;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
@@ -267,21 +268,35 @@ impl MainStatus {
|
|||||||
&manifest.volumes,
|
&manifest.volumes,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
let mut should_stop = false;
|
||||||
for (check, res) in health {
|
for (check, res) in health {
|
||||||
if matches!(
|
match &res.result {
|
||||||
res.result,
|
health_check::HealthCheckResultVariant::Failure { error }
|
||||||
health_check::HealthCheckResultVariant::Failure { .. }
|
if manifest
|
||||||
) && manifest
|
.health_checks
|
||||||
.health_checks
|
.0
|
||||||
.0
|
.get(check)
|
||||||
.get(check)
|
.map(|hc| hc.critical)
|
||||||
.map(|hc| hc.critical)
|
.unwrap_or_default() =>
|
||||||
.unwrap_or_default()
|
{
|
||||||
{
|
notify(
|
||||||
todo!("emit notification");
|
&ctx.secret_store,
|
||||||
*self = MainStatus::Stopping;
|
&ctx.db,
|
||||||
|
Some(manifest.id.clone()),
|
||||||
|
NotificationLevel::Error,
|
||||||
|
String::from("Critical Health Check Failed"),
|
||||||
|
format!("{} was shut down because a health check required for its operation failed\n{}", manifest.title, error),
|
||||||
|
NotificationSubtype::General
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
should_stop = true;
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if should_stop {
|
||||||
|
*self = MainStatus::Stopping;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user