mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
silence service crash notifications (#1929)
This commit is contained in:
@@ -8,7 +8,6 @@ use std::task::Poll;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use bollard::container::{KillContainerOptions, StopContainerOptions};
|
use bollard::container::{KillContainerOptions, StopContainerOptions};
|
||||||
use chrono::Utc;
|
|
||||||
use color_eyre::eyre::eyre;
|
use color_eyre::eyre::eyre;
|
||||||
use embassy_container_init::{InputJsonRpc, RpcId};
|
use embassy_container_init::{InputJsonRpc, RpcId};
|
||||||
use models::{ExecCommand, TermCommand};
|
use models::{ExecCommand, TermCommand};
|
||||||
@@ -41,7 +40,8 @@ use crate::Error;
|
|||||||
pub mod health;
|
pub mod health;
|
||||||
mod sync;
|
mod sync;
|
||||||
|
|
||||||
pub const HEALTH_CHECK_COOLDOWN_SECONDS: u64 = 60;
|
pub const HEALTH_CHECK_COOLDOWN_SECONDS: u64 = 15;
|
||||||
|
pub const HEALTH_CHECK_GRACE_PERIOD_SECONDS: u64 = 5;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct ManagerMap(RwLock<BTreeMap<(PackageId, Version), Arc<Manager>>>);
|
pub struct ManagerMap(RwLock<BTreeMap<(PackageId, Version), Arc<Manager>>>);
|
||||||
@@ -466,12 +466,7 @@ async fn manager_thread_loop(
|
|||||||
.get(&mut db, false)
|
.get(&mut db, false)
|
||||||
.await;
|
.await;
|
||||||
match started.as_deref() {
|
match started.as_deref() {
|
||||||
Ok(Some(MainStatus::Running { started, .. }))
|
Ok(Some(MainStatus::Running { .. })) if cfg!(feature = "unstable") => {
|
||||||
if cfg!(feature = "unstable")
|
|
||||||
|| (Utc::now().signed_duration_since(*started)
|
|
||||||
> chrono::Duration::from_std(Duration::from_secs(60)).unwrap()
|
|
||||||
&& !matches!(&*thread_shared.on_stop.borrow(), &OnStop::Exit)) =>
|
|
||||||
{
|
|
||||||
let res = thread_shared.ctx.notification_manager
|
let res = thread_shared.ctx.notification_manager
|
||||||
.notify(
|
.notify(
|
||||||
&mut db,
|
&mut db,
|
||||||
@@ -880,7 +875,7 @@ fn fetch_starting_to_running(state: &Arc<ManagerSharedState>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn main_health_check_daemon(state: Arc<ManagerSharedState>) {
|
async fn main_health_check_daemon(state: Arc<ManagerSharedState>) {
|
||||||
tokio::time::sleep(Duration::from_secs(10)).await;
|
tokio::time::sleep(Duration::from_secs(HEALTH_CHECK_GRACE_PERIOD_SECONDS)).await;
|
||||||
loop {
|
loop {
|
||||||
let mut db = state.ctx.db.handle();
|
let mut db = state.ctx.db.handle();
|
||||||
if let Err(e) = health::check(
|
if let Err(e) = health::check(
|
||||||
|
|||||||
Reference in New Issue
Block a user