Skip to content

Commit

Permalink
core shutdown experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Sep 18, 2023
1 parent 405cc14 commit 7ae2643
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ analyzer-target
.DS_Store
*.code-workspace
/setup
datadir
32 changes: 32 additions & 0 deletions kaspad/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,35 @@ do you confirm? (answer y/n or pass --yes to the Kaspad command line to confirm

core
}

#[cfg(test)]
mod tests {

use super::{create_core_with_runtime, Runtime};
use kaspa_core::signals::Shutdown;

fn test_core(runtime: &Runtime) {
let mut args = crate::args::Args::default();
args.rpclisten = None;
args.rpclisten_borsh = None;
args.testnet = true;
println!("| creating core...");
let core = create_core_with_runtime(runtime, &args);
let workers = core.start();
println!("| waiting...");
std::thread::sleep(std::time::Duration::from_secs(3));
println!("| shutting down core...");
core.shutdown();
core.join(workers);
println!("| core shutdown ok...");
}

#[test]
fn test_kaspad_cleanup() {
kaspa_core::log::try_init_logger("INFO");
let runtime = super::Runtime::default();
test_core(&runtime);
std::thread::sleep(std::time::Duration::from_secs(3));
test_core(&runtime);
}
}

0 comments on commit 7ae2643

Please sign in to comment.