mirror of https://gitee.com/bigwinds/arangodb
Wait 2s after switching server mode before answering. (#6390)
This is needed because the change is propagated via the agency and the heartbeat, which only happens once per second.
This commit is contained in:
parent
2478e5ae18
commit
bdf8c7d1a4
|
@ -794,6 +794,10 @@ Result ServerState::propagateClusterReadOnly(bool mode) {
|
|||
if (!r.successful()) {
|
||||
return Result(TRI_ERROR_CLUSTER_AGENCY_COMMUNICATION_FAILED, r.errorMessage());
|
||||
}
|
||||
// This is propagated to all servers via the heartbeat, which happens
|
||||
// once per second. So to ensure that every server has taken note of
|
||||
// the change, we delay here for 2 seconds.
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
}
|
||||
setReadOnly(mode);
|
||||
return Result();
|
||||
|
|
Loading…
Reference in New Issue