Skip to content

Commit

Permalink
fix: notify message blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangsoledad committed Dec 10, 2022
1 parent 5487461 commit f4e20df
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 56 deletions.
7 changes: 3 additions & 4 deletions block-filter/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ impl BlockFilter {
async_handle.spawn_blocking(move || filter_data_builder.build_filter_data());

async_handle.spawn(async move {
let mut new_block_receiver = notify_controller
.subscribe_new_block(NAME.to_string())
.await;
let mut new_block_watcher = notify_controller.watch_new_block(NAME.to_string()).await;
let _build_filter_data_finished = build_filter_data.await;

loop {
tokio::select! {
Some(_) = new_block_receiver.recv() => {
Ok(_) = new_block_watcher.changed() => {
block_in_place(|| self.build_filter_data());
new_block_watcher.borrow_and_update();
}
_ = &mut stop_rx => break,
else => break,
Expand Down
Loading

0 comments on commit f4e20df

Please sign in to comment.