-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Config sanity check * Add max_queued_txs * Update metrics * Cleanup Cargo.toml * Add log to start service * Revert "Add max_queued_txs" This reverts commit 83c517d. * Add shutdown listening (non-graceful) * clippy + fmt
- Loading branch information
Showing
9 changed files
with
124 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use core::panic; | ||
|
||
use tokio::signal::unix::{signal, SignalKind}; | ||
|
||
pub fn spawn_await_shutdown_task() { | ||
tokio::spawn(async { | ||
let result = await_shutdown_signal().await; | ||
if let Err(err) = result { | ||
tracing::error!("Error while waiting for shutdown signal: {}", err); | ||
panic!("Error while waiting for shutdown signal: {}", err); | ||
} | ||
|
||
tracing::info!("Shutdown complete"); | ||
std::process::exit(0); | ||
}); | ||
} | ||
|
||
pub async fn await_shutdown_signal() -> eyre::Result<()> { | ||
let mut sigint = signal(SignalKind::interrupt())?; | ||
let mut sigterm = signal(SignalKind::terminate())?; | ||
|
||
tokio::select! { | ||
_ = sigint.recv() => { tracing::info!("SIGINT received, shutting down"); } | ||
_ = sigterm.recv() => { tracing::info!("SIGTERM received, shutting down"); } | ||
}; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters