Send statements to own backing group first (#2927)

* Factor out runtime module into utils.

* First fatal error design.

* Better error handling infra.

* Error handling cleanup.

* Send to peers of our group first.

* Finish backing group prioritization.

* Little cleanup.

* More cleanup.

* Forgot to checkin error.rs.

* Notes.

* Runtime -> RuntimeInfo

* qed in debug assert.

* PolkaErr -> Fault.
This commit is contained in:
Robert Klotzner
2021-04-27 21:47:32 +02:00
committed by GitHub
parent 36bd876311
commit c86a774b9d
17 changed files with 1031 additions and 280 deletions
@@ -28,7 +28,7 @@ use polkadot_subsystem::{
SubsystemContext, jaeger,
};
use crate::error::{Error, Result};
use crate::error::{NonFatal, Result};
use crate::{LOG_TARGET, metrics::{Metrics, SUCCEEDED, FAILED, NOT_FOUND}};
/// Variant of `answer_pov_request` that does Prometheus metric and logging on errors.
@@ -107,7 +107,7 @@ where
}
};
req.send_response(response).map_err(|_| Error::SendResponse)?;
req.send_response(response).map_err(|_| NonFatal::SendResponse)?;
Ok(result)
}
@@ -144,7 +144,7 @@ where
Some(chunk) => v1::ChunkFetchingResponse::Chunk(chunk.into()),
};
req.send_response(response).map_err(|_| Error::SendResponse)?;
req.send_response(response).map_err(|_| NonFatal::SendResponse)?;
Ok(result)
}
@@ -164,7 +164,7 @@ where
))
.await;
rx.await.map_err(|e| {
let result = rx.await.map_err(|e| {
tracing::trace!(
target: LOG_TARGET,
?validator_index,
@@ -172,8 +172,9 @@ where
error = ?e,
"Error retrieving chunk",
);
Error::QueryChunkResponseChannel(e)
})
NonFatal::QueryChunkResponseChannel(e)
})?;
Ok(result)
}
/// Query PoV from the availability store.
@@ -191,5 +192,6 @@ where
))
.await;
rx.await.map_err(|e| Error::QueryAvailableDataResponseChannel(e))
let result = rx.await.map_err(|e| NonFatal::QueryAvailableDataResponseChannel(e))?;
Ok(result)
}