Update engine state in broadcast (#3071)
## Issue Addressed N/A ## Proposed Changes Set the engine state to `EngineState::Offline` if the engine api call fails during broadcast. This caused issues while pausing sync when the execution engine is offline because `EngineState` always returned `Synced`.
This commit is contained in:
parent
20e32f5812
commit
a42cb69f6e
@ -399,18 +399,22 @@ impl<T: EngineApi> Engines<T> {
|
|||||||
let futures = self.engines.iter().map(|engine| async move {
|
let futures = self.engines.iter().map(|engine| async move {
|
||||||
let is_offline = *engine.state.read().await == EngineState::Offline;
|
let is_offline = *engine.state.read().await == EngineState::Offline;
|
||||||
if !is_offline {
|
if !is_offline {
|
||||||
func(engine).await.map_err(|error| {
|
match func(engine).await {
|
||||||
debug!(
|
Ok(res) => Ok(res),
|
||||||
self.log,
|
Err(error) => {
|
||||||
"Execution engine call failed";
|
debug!(
|
||||||
"error" => ?error,
|
self.log,
|
||||||
"id" => &engine.id
|
"Execution engine call failed";
|
||||||
);
|
"error" => ?error,
|
||||||
EngineError::Api {
|
"id" => &engine.id
|
||||||
id: engine.id.clone(),
|
);
|
||||||
error,
|
*engine.state.write().await = EngineState::Offline;
|
||||||
|
Err(EngineError::Api {
|
||||||
|
id: engine.id.clone(),
|
||||||
|
error,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(EngineError::Offline {
|
Err(EngineError::Offline {
|
||||||
id: engine.id.clone(),
|
id: engine.id.clone(),
|
||||||
|
Loading…
Reference in New Issue
Block a user