Make sure we poll authority event stream until all events are processed (#5608)

* Make sure we poll authority event stream until all events are processed

* Add test
This commit is contained in:
Bastian Köcher
2020-04-11 22:12:38 +02:00
committed by GitHub
parent bd91e58a9a
commit c0219f40d1
2 changed files with 86 additions and 16 deletions
+11 -13
View File
@@ -538,21 +538,19 @@ where
Ok(())
};
match inner() {
Ok(()) => {}
loop {
match inner() {
Ok(()) => return Poll::Pending,
// Handle fatal errors.
//
// Given that the network likely terminated authority discovery should do the same.
Err(Error::DhtEventStreamTerminated) => return Poll::Ready(()),
// Handle fatal errors.
//
// Given that the network likely terminated authority discovery should do the same.
Err(Error::DhtEventStreamTerminated) => return Poll::Ready(()),
// Handle non-fatal errors.
Err(e) => error!(target: "sub-authority-discovery", "Poll failure: {:?}", e),
};
// Return Poll::Pending as this is a long running task with the same lifetime as the node
// itself.
Poll::Pending
// Handle non-fatal errors.
Err(e) => error!(target: "sub-authority-discovery", "Poll failure: {:?}", e),
};
}
}
}