Skip to content

Commit 9187bef

Browse files
author
Ivo Georgiev
committed
validator_worker: bugfix: handle tick errors
1 parent ecf96a6 commit 9187bef

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

validator_worker/src/main.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,17 @@ async fn validator_tick<A: Adapter + 'static>(
198198

199199
match channel.spec.validators.find(&whoami) {
200200
SpecValidator::Leader(_) => {
201-
if let Err(e) = timeout(duration, leader::tick(&sentry)).await {
202-
return Err(ValidatorWorkerError::Failed(e.to_string()));
201+
match timeout(duration, leader::tick(&sentry)).await {
202+
Err(e) => return Err(ValidatorWorkerError::Failed(e.to_string())),
203+
Ok(Err(e)) => return Err(ValidatorWorkerError::Failed(e.to_string())),
204+
_ => ()
203205
}
204206
}
205207
SpecValidator::Follower(_) => {
206-
if let Err(e) = timeout(duration, follower::tick(&sentry)).await {
207-
return Err(ValidatorWorkerError::Failed(e.to_string()));
208+
match timeout(duration, follower::tick(&sentry)).await {
209+
Err(e) => return Err(ValidatorWorkerError::Failed(e.to_string())),
210+
Ok(Err(e)) => return Err(ValidatorWorkerError::Failed(e.to_string())),
211+
_ => ()
208212
}
209213
}
210214
SpecValidator::None => {

0 commit comments

Comments
 (0)