Skip to content

Commit e0386e4

Browse files
committed
premature exit bug fix
1 parent c9f1d9f commit e0386e4

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ DKN_P2P_LISTEN_ADDR=/ip4/0.0.0.0/tcp/4001
1616
DKN_RELAY_NODES=
1717
# Comma-separated static bootstrap nodes
1818
DKN_BOOTSTRAP_NODES=
19+
20+
## DRIA (profiling only, do not uncomment) ##
1921
# Set to a number of seconds to wait before exiting, only use in profiling build!
2022
# Otherwise, leave this empty.
21-
DKN_EXIT_TIMEOUT=
23+
# DKN_EXIT_TIMEOUT=
2224

2325
## Open AI (if used, required) ##
2426
OPENAI_API_KEY=

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default-members = ["compute"]
77

88
[workspace.package]
99
edition = "2021"
10-
version = "0.2.13"
10+
version = "0.2.14"
1111
license = "Apache-2.0"
1212
readme = "README.md"
1313

compute/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ async fn main() -> Result<()> {
3131
let token = CancellationToken::new();
3232
let cancellation_token = token.clone();
3333
tokio::spawn(async move {
34-
if let Ok(timeout_str) = env::var("DKN_EXIT_TIMEOUT").map(|s| s.trim().to_string()) {
35-
let duration_secs = timeout_str.parse().unwrap_or(120);
34+
if let Ok(Ok(duration_secs)) =
35+
env::var("DKN_EXIT_TIMEOUT").map(|s| s.to_string().parse::<u64>())
36+
{
3637
log::warn!("Waiting for {} seconds before exiting.", duration_secs);
3738
tokio::time::sleep(tokio::time::Duration::from_secs(duration_secs)).await;
39+
40+
log::warn!("Exiting due to DKN_EXIT_TIMEOUT.");
3841
cancellation_token.cancel();
3942
} else if let Err(err) = wait_for_termination(cancellation_token.clone()).await {
4043
log::error!("Error waiting for termination: {:?}", err);

0 commit comments

Comments
 (0)