mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
fix(rust): don't block runtime shutdown (#10204)
By default, dropping a `tokio` runtime waits until all tasks have finished. The tasks we spawn within `connlib` can have complex dependencies with each other. To ensure that we can shut down in any case and don't hang, we apply a timeout of 1s to the runtime.
This commit is contained in:
@@ -20,6 +20,7 @@ use secrecy::{Secret, SecretString};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use tokio::time::Instant;
|
||||
|
||||
@@ -355,7 +356,11 @@ fn main() -> Result<()> {
|
||||
drop(session);
|
||||
|
||||
result
|
||||
})
|
||||
})?;
|
||||
|
||||
rt.shutdown_timeout(Duration::from_secs(1));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Read the token from disk if it was not in the environment
|
||||
|
||||
Reference in New Issue
Block a user