mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: gracefully shutdown prometheus server (#7728)
Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me> Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com>
This commit is contained in:
@ -148,7 +148,7 @@ impl<Ext: clap::Args + fmt::Debug> Cli<Ext> {
|
||||
Commands::Import(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
||||
Commands::DumpGenesis(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
||||
Commands::Db(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
||||
Commands::Stage(command) => runner.run_blocking_until_ctrl_c(command.execute()),
|
||||
Commands::Stage(command) => runner.run_command_until_exit(|ctx| command.execute(ctx)),
|
||||
Commands::P2P(command) => runner.run_until_ctrl_c(command.execute()),
|
||||
Commands::TestVectors(command) => runner.run_until_ctrl_c(command.execute()),
|
||||
Commands::Config(command) => runner.run_until_ctrl_c(command.execute()),
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
//! `reth stage` command
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_cli_runner::CliContext;
|
||||
|
||||
pub mod drop;
|
||||
pub mod dump;
|
||||
@ -34,9 +35,9 @@ pub enum Subcommands {
|
||||
|
||||
impl Command {
|
||||
/// Execute `stage` command
|
||||
pub async fn execute(self) -> eyre::Result<()> {
|
||||
pub async fn execute(self, ctx: CliContext) -> eyre::Result<()> {
|
||||
match self.command {
|
||||
Subcommands::Run(command) => command.execute().await,
|
||||
Subcommands::Run(command) => command.execute(ctx).await,
|
||||
Subcommands::Drop(command) => command.execute().await,
|
||||
Subcommands::Dump(command) => command.execute().await,
|
||||
Subcommands::Unwind(command) => command.execute().await,
|
||||
|
||||
@ -14,6 +14,7 @@ use crate::{
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::{config::EtlConfig, Config};
|
||||
use reth_db::init_db;
|
||||
use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
|
||||
@ -120,7 +121,7 @@ pub struct Command {
|
||||
|
||||
impl Command {
|
||||
/// Execute `stage` command
|
||||
pub async fn execute(self) -> eyre::Result<()> {
|
||||
pub async fn execute(self, ctx: CliContext) -> eyre::Result<()> {
|
||||
// Raise the fd limit of the process.
|
||||
// Does not do anything on windows.
|
||||
let _ = fdlimit::raise_fd_limit();
|
||||
@ -154,6 +155,7 @@ impl Command {
|
||||
Arc::clone(&db),
|
||||
factory.static_file_provider(),
|
||||
metrics_process::Collector::default(),
|
||||
ctx.task_executor,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user