Skip to content

Commit

Permalink
Merge pull request nervosnetwork#4348 from eval-exec/exec/fix-indexer…
Browse files Browse the repository at this point in the history
…-exit-signal-2

IndexerService should use `is_cancelled()` to check if ckb received Ctrl-C signal
  • Loading branch information
quake authored Feb 9, 2024
2 parents ba12318 + 652ce50 commit 2615601
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
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");
return;
}

let mut new_block_watcher = notify_controller
Expand Down

0 comments on commit 2615601

Please sign in to comment.