remove flakiness (#5572)

This commit is contained in:
Nikolay Volf authored and GitHub committed 2020-04-08 11:49:32 +02:00
1 parent 762bcbab03
commit c73398ab03
4 files changed
+21 -13

No files matched your search

@@ -30,7 +30,7 @@ use std::time::Duration;
#[cfg(not(test))]
const BACKGROUND_REVALIDATION_INTERVAL: Duration = Duration::from_millis(200);
#[cfg(test)]
pub const BACKGROUND_REVALIDATION_INTERVAL: Duration = Duration::from_millis(5);
pub const BACKGROUND_REVALIDATION_INTERVAL: Duration = Duration::from_millis(1);
const BACKGROUND_REVALIDATION_BATCH_SIZE: usize = 20;
@@ -214,12 +214,21 @@ impl<Api: ChainApi> RevalidationWorker<Api> {
loop {
futures::select! {
_ = interval.next() => {
_guard = interval.next() => {
let next_batch = this.prepare_batch();
let batch_len = next_batch.len();
batch_revalidate(this.pool.clone(), this.api.clone(), this.best_block, next_batch).await;
#[cfg(test)]
{
use intervalier::Guard;
// only trigger test events if something was processed
if batch_len == 0 {
_guard.expect("Always some() in tests").skip();
}
}
if batch_len > 0 || this.len() > 0 {
log::debug!(
target: "txpool",