mirror of
https://github.com/XRPLF/clio.git
synced 2026-07-26 08:30:24 +00:00
feat: Recover from fallback writer state (#3000)
Add a timer and new `FallbackRecovery` state to try to recover from `Fallback` writer state every hour. Fixes #2997
This commit is contained in:
@@ -66,6 +66,10 @@ ClioNode::from(
|
||||
return ClioNode::DbRole::Fallback;
|
||||
}
|
||||
|
||||
if (writerState.isFallbackRecovery()) {
|
||||
return ClioNode::DbRole::FallbackRecovery;
|
||||
}
|
||||
|
||||
return writerState.isWriting() ? ClioNode::DbRole::Writer : ClioNode::DbRole::NotWriter;
|
||||
}();
|
||||
return ClioNode{
|
||||
@@ -105,7 +109,7 @@ tag_invoke(boost::json::value_to_tag<ClioNode>, boost::json::value const& jv)
|
||||
auto dbRole = ClioNode::DbRole::Fallback;
|
||||
if (auto const* v = obj.if_contains(JsonFields::kDB_ROLE)) {
|
||||
auto const dbRoleValue = v->as_int64();
|
||||
if (dbRoleValue > static_cast<int64_t>(ClioNode::DbRole::MAX))
|
||||
if (dbRoleValue > static_cast<int64_t>(ClioNode::DbRole::Max))
|
||||
throw std::runtime_error("Invalid db_role value");
|
||||
dbRole = static_cast<ClioNode::DbRole>(dbRoleValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user