Fix parachains_loop::tests::minimal_working_case

This commit is contained in:
Serban Iorga
2022-10-21 13:43:59 +03:00
committed by Bastian Köcher
parent e97bb57564
commit a372fd6394
@@ -24,7 +24,7 @@ use bp_polkadot_core::{
}; };
use futures::{ use futures::{
future::{FutureExt, Shared}, future::{FutureExt, Shared},
poll, select, poll, select_biased,
}; };
use relay_substrate_client::{BlockNumberOf, Chain, HeaderIdOf}; use relay_substrate_client::{BlockNumberOf, Chain, HeaderIdOf};
use relay_utils::{ use relay_utils::{
@@ -216,10 +216,12 @@ where
// regular errors. // regular errors.
loop { loop {
// either wait for new block, or exit signal // Either wait for new block, or exit signal.
select! { // Please note that we are prioritizing the exit signal since if both events happen at once
_ = async_std::task::sleep(min_block_interval).fuse() => {}, // it doesn't make sense to perform one more loop iteration.
select_biased! {
_ = exit_signal => return Ok(()), _ = exit_signal => return Ok(()),
_ = async_std::task::sleep(min_block_interval).fuse() => {},
} }
// if source client is not yet synced, we'll need to sleep. Otherwise we risk submitting too // if source client is not yet synced, we'll need to sleep. Otherwise we risk submitting too