1
0
Fork 0

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:
Max Neunhöffer 2018-09-05 17:04:27 +02:00 committed by GitHub
parent 2478e5ae18
commit bdf8c7d1a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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();