Move SingletonRecruitThrottler to SingletonRoles.h

This commit is contained in:
sfc-gh-tclinkenbeard 2022-12-11 13:10:45 -08:00 committed by Trevor Clinkenbeard
parent 68547a2dbd
commit 1efe06da20
2 changed files with 14 additions and 14 deletions

View File

@ -1966,20 +1966,6 @@ ACTOR Future<Void> handleTriggerAuditStorage(ClusterControllerData* self, Cluste
}
}
struct SingletonRecruitThrottler {
double lastRecruitStart;
SingletonRecruitThrottler() : lastRecruitStart(-1) {}
double newRecruitment() {
double n = now();
double waitTime =
std::max(0.0, (lastRecruitStart + SERVER_KNOBS->CC_THROTTLE_SINGLETON_RERECRUIT_INTERVAL - n));
lastRecruitStart = n;
return waitTime;
}
};
ACTOR Future<Void> startDataDistributor(ClusterControllerData* self, double waitTime) {
// If master fails at the same time, give it a chance to clear master PID.
// Also wait to avoid too many consecutive recruits in a small time window.

View File

@ -199,3 +199,17 @@ struct EncryptKeyProxySingleton : Singleton<EncryptKeyProxyInterface> {
cc.recruitEncryptKeyProxy.set(true);
}
};
struct SingletonRecruitThrottler {
double lastRecruitStart;
SingletonRecruitThrottler() : lastRecruitStart(-1) {}
double newRecruitment() {
double n = now();
double waitTime =
std::max(0.0, (lastRecruitStart + SERVER_KNOBS->CC_THROTTLE_SINGLETON_RERECRUIT_INTERVAL - n));
lastRecruitStart = n;
return waitTime;
}
};