fix: Cleanup by sending a command and kill when dropped (#1945)

* fix: Cleanup by sending a command and kill when dropped

* chore: Fix the loadModule run command

* fix: cleans up failed health

* refactor long-running

* chore: Fixes?"

* refactor

* run iso ci on pr

* fix debuild

* fix tests

* switch to libc kill

* kill process by parent

* fix graceful shutdown

* recurse submodules

* fix compat build

* feat: Add back in the timeout

* chore: add the missing types for the unnstable

* inherited logs

Co-authored-by: J M <Blu-J@users.noreply.github.com>

* fix deleted code

Co-authored-by: Aiden McClelland <me@drbonez.dev>
Co-authored-by: J M <Blu-J@users.noreply.github.com>
This commit is contained in:
J M
2022-11-18 19:19:04 -07:00
committed by Aiden McClelland
parent eec8c41e20
commit a3d1b2d671
39 changed files with 1866 additions and 1845 deletions

View File

@@ -10,7 +10,6 @@ bollard = "0.13.0"
color-eyre = "0.6.1"
ed25519-dalek = { version = "1.0.1", features = ["serde"] }
mbrman = "0.5.0"
embassy_container_init = { path = "../embassy_container_init" }
emver = { version = "0.1", git = "https://github.com/Start9Labs/emver-rs.git", features = [
"serde",
] }

View File

@@ -1,9 +1,11 @@
use std::fmt::Display;
use crate::InvalidId;
use color_eyre::eyre::eyre;
use patch_db::Revision;
use rpc_toolkit::{hyper::http::uri::InvalidUri, yajrc::RpcError};
use rpc_toolkit::hyper::http::uri::InvalidUri;
use rpc_toolkit::yajrc::RpcError;
use crate::InvalidId;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ErrorKind {

View File

@@ -7,7 +7,6 @@ mod interface_id;
mod invalid_id;
mod package_id;
mod procedure_name;
mod type_aliases;
mod version;
mod volume_id;
@@ -20,6 +19,5 @@ pub use interface_id::*;
pub use invalid_id::*;
pub use package_id::*;
pub use procedure_name::*;
pub use type_aliases::*;
pub use version::*;
pub use volume_id::*;

View File

@@ -14,6 +14,7 @@ pub enum ProcedureName {
AutoConfig(PackageId),
Health(HealthCheckId),
Action(ActionId),
Signal,
}
impl ProcedureName {
@@ -31,6 +32,7 @@ impl ProcedureName {
ProcedureName::Action(id) => Some(format!("{}Action", id)),
ProcedureName::Check(_) => None,
ProcedureName::AutoConfig(_) => None,
ProcedureName::Signal => None,
}
}
pub fn js_function_name(&self) -> Option<String> {
@@ -47,6 +49,7 @@ impl ProcedureName {
ProcedureName::Action(id) => Some(format!("/action/{}", id)),
ProcedureName::Check(id) => Some(format!("/dependencies/{}/check", id)),
ProcedureName::AutoConfig(id) => Some(format!("/dependencies/{}/autoConfigure", id)),
ProcedureName::Signal => Some("/handleSignal".to_string()),
}
}
}

View File

@@ -1,25 +0,0 @@
use std::{future::Future, pin::Pin, sync::Arc, time::Duration};
use embassy_container_init::RpcId;
use tokio::sync::mpsc::UnboundedSender;
/// Used by the js-executor, it is the ability to just create a command in an already running exec
pub type ExecCommand = Arc<
dyn Fn(
String,
Vec<String>,
UnboundedSender<embassy_container_init::Output>,
Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<RpcId, String>> + 'static>>
+ Send
+ Sync
+ 'static,
>;
/// Used by the js-executor, it is the ability to just create a command in an already running exec
pub type TermCommand = Arc<
dyn Fn(RpcId) -> Pin<Box<dyn Future<Output = Result<(), String>> + 'static>>
+ Send
+ Sync
+ 'static,
>;