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

IndexerService should use is_cancelled() to check if ckb received Ctrl-C signal #4348

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion util/app-config/src/tests/graceful_shutdown.bats
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function ckb_graceful_shutdown { #@test
assert_output --regexp "INFO ckb_tx_pool::chunk_process TxPool chunk_command service received exit signal, exit now"
assert_output --regexp "INFO ckb_tx_pool::service TxPool is saving, please wait..."
assert_output --regexp "INFO ckb_tx_pool::service TxPool reorg process service received exit signal, exit now"
assert_output --regexp "INFO ckb_indexer::service Indexer received exit signal, cancel new_block_watcher task, exit now"
assert_output --regexp "INFO ckb_indexer::service Indexer received exit signal, exit now"
assert_output --regexp "INFO ckb_notify NotifyService received exit signal, exit now"
assert_output --regexp "INFO ckb_block_filter::filter BlockFilter received exit signal, exit now"
assert_output --regexp "INFO ckb_sync::types::header_map HeaderMap limit_memory received exit signal, exit now"
Expand Down
10 changes: 3 additions & 7 deletions util/indexer/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,9 @@ impl IndexerService {
self.async_handle.spawn(async move {
let _initial_finished = initial_syncing.await;
info!("initial_syncing finished");

tokio::select! {
_ = stop.cancelled() => {
info!("Indexer received exit signal, cancel new_block_watcher task, exit now");
return;
},
else => {},
if stop.is_cancelled() {
info!("Indexer received exit signal, cancel new_block_watcher task, exit now");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if use rich-indexer,this content need update? auto get indexer type which is using

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed. The version of CKB that includes rich-indexer has been refactored, and this check is moved to the module indexer-sync, which is common to both indexer and rich-indexer.

return;
}

let mut new_block_watcher = notify_controller
Expand Down
Loading