Skip to content

Commit

Permalink
Generate default.db-options file if it not exist, nervosnetwork#4671
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec committed Oct 28, 2024
1 parent c49fdbf commit 03ce485
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ckb-bin/src/subcommand/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,27 @@ use ckb_async_runtime::{new_global_runtime, Handle};
use ckb_build_info::Version;
use ckb_launcher::Launcher;
use ckb_logger::info;
use ckb_resource::{Resource, TemplateContext};

use ckb_stop_handler::{broadcast_exit_signals, wait_all_ckb_services_exit};

use ckb_types::core::cell::setup_system_cell_cache;

pub fn run(args: RunArgs, version: Version, async_handle: Handle) -> Result<(), ExitCode> {
{
// check is there a default.db-options file exist in args.config.root_dir, if not, create one.
let db_options_path = args.config.root_dir.join("default.db-options");

// Check if the default.db-options file exists, if not, create one.
if !db_options_path.exists() {
// context_for_db_options is used to generate a default default.db-options file.
let context_for_db_options = TemplateContext::new("", Default::default());

// Attempt to export the bundled DB options to the specified path.
Resource::bundled_db_options()
.export(&context_for_db_options, &args.config.root_dir)?;
}
}
deadlock_detection();

let rpc_threads_num = calc_rpc_threads_num(&args);
Expand Down

0 comments on commit 03ce485

Please sign in to comment.