Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce launcher #2613

Merged

Conversation

zhangsoledad
Copy link
Member

@zhangsoledad zhangsoledad commented Mar 12, 2021

this PR mainly simplified the launch code

pub fn run(args: RunArgs, version: Version, async_handle: Handle) -> Result<(), ExitCode> {
deadlock_detection();
info!("ckb version: {}", version);
let mut launcher = Launcher::new(args, version, async_handle);
let block_assembler_config = launcher.sanitize_block_assembler_config()?;
let miner_enable = block_assembler_config.is_some();
let exit_handler = DefaultExitHandler::default();
launcher.migrate_guard()?;
let (shared, table) = launcher.build_shared(block_assembler_config)?;
// spawn freezer background process
let _freezer = shared.spawn_freeze();
setup_system_cell_cache(
shared.consensus().genesis_block(),
&shared.store().cell_provider(),
);
rayon::ThreadPoolBuilder::new()
.thread_name(|i| format!("RayonGlobal-{}", i))
.build_global()
.expect("Init the global thread pool for rayon failed");
ckb_memory_tracker::track_current_process(
launcher.args.config.memory_tracker.interval,
Some(shared.store().db().inner()),
);
launcher.check_assume_valid_target(&shared);
let chain_controller = launcher.start_chain_service(&shared, table);
let (network_controller, rpc_server) =
launcher.start_network_and_rpc(&shared, chain_controller, &exit_handler, miner_enable);
let exit_handler_clone = exit_handler.clone();
ctrlc::set_handler(move || {
exit_handler_clone.notify_exit();
})
.expect("Error setting Ctrl-C handler");
exit_handler.wait_for_exit();
info!("Finishing work, please wait...");
drop(rpc_server);
drop(network_controller);
Ok(())
}

shared/src/lib.rs Show resolved Hide resolved
quake
quake previously approved these changes Mar 12, 2021
@zhangsoledad zhangsoledad dismissed stale reviews from quake and yangby-cryptape via c05c0a3 March 12, 2021 08:05
@doitian doitian requested a review from quake March 16, 2021 09:41
quake
quake previously approved these changes Mar 18, 2021
@zhangsoledad
Copy link
Member Author

bors r=yangby-cryptape,quake

bors bot added a commit that referenced this pull request Mar 18, 2021
2613: Introduce launcher  r=yangby-cryptape,quake a=zhangsoledad

this PR mainly simplified the launch code
https://github.com/nervosnetwork/ckb/blob/853eaf5ab5f5a9b678f496abb74cf576a3501804/ckb-bin/src/subcommand/run.rs#L11-L62


Co-authored-by: zhangsoledad <787953403@qq.com>
@bors
Copy link
Contributor

bors bot commented Mar 18, 2021

Build failed:

@zhangsoledad
Copy link
Member Author

bors retry

bors bot added a commit that referenced this pull request Mar 19, 2021
2613: Introduce launcher  r=yangby-cryptape,quake a=zhangsoledad

this PR mainly simplified the launch code
https://github.com/nervosnetwork/ckb/blob/853eaf5ab5f5a9b678f496abb74cf576a3501804/ckb-bin/src/subcommand/run.rs#L11-L62


Co-authored-by: zhangsoledad <787953403@qq.com>
@bors
Copy link
Contributor

bors bot commented Mar 19, 2021

Build failed:

@zhangsoledad
Copy link
Member Author

bors retry

bors bot added a commit that referenced this pull request Mar 19, 2021
2613: Introduce launcher  r=yangby-cryptape,quake a=zhangsoledad

this PR mainly simplified the launch code
https://github.com/nervosnetwork/ckb/blob/853eaf5ab5f5a9b678f496abb74cf576a3501804/ckb-bin/src/subcommand/run.rs#L11-L62


Co-authored-by: zhangsoledad <787953403@qq.com>
@bors
Copy link
Contributor

bors bot commented Mar 19, 2021

Build failed:

  • continuous-integration/travis-ci/push

@zhangsoledad zhangsoledad dismissed stale reviews from quake and yangby-cryptape via bb1e050 March 25, 2021 04:12
@zhangsoledad zhangsoledad force-pushed the zhangsoledad/refactor-initialize branch 2 times, most recently from bb1e050 to dbef17a Compare March 25, 2021 04:43
@yangby-cryptape
Copy link
Collaborator

bors r=yangby-cryptape,quake

@bors
Copy link
Contributor

bors bot commented Mar 26, 2021

Build succeeded:

@bors bors bot merged commit fc94d8c into nervosnetwork:develop Mar 26, 2021
@zhangsoledad zhangsoledad deleted the zhangsoledad/refactor-initialize branch March 26, 2021 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants