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:
Thomas Eizinger
2025-08-18 11:59:03 +10:00
committed by GitHub
parent c8b01d9f43
commit 0f2cfa2e3c
5 changed files with 38 additions and 13 deletions

View File

@@ -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