Move client failure cleanup

This commit is contained in:
Lukas Joswiak 2021-08-23 12:54:03 -07:00
parent eaac647558
commit 08892eab55
1 changed files with 12 additions and 12 deletions

View File

@ -201,6 +201,18 @@ class ConfigBroadcasterImpl {
}
ACTOR static Future<Void> waitForFailure(ConfigBroadcasterImpl* self, Future<Void> watcher, UID clientUID) {
// Clean up clientFailures futures. The values in this map should only
// be used for testing, and cleaning them up here ensures tests still
// have enough time to read the future while making sure the map
// doesn't grow unbounded.
for (auto it = self->clientFailures.begin(); it != self->clientFailures.end();) {
if (it->second.isReady()) {
it = self->clientFailures.erase(it);
} else {
++it;
}
}
wait(watcher);
TraceEvent(SevDebug, "ConfigBroadcastClientDied", self->id).detail("ClientID", clientUID);
self->clients.erase(clientUID);
@ -224,18 +236,6 @@ class ConfigBroadcasterImpl {
return Void();
}
// Clean up clientFailures futures. The values in this map should only
// be used for testing, and cleaning them up here ensures tests still
// have enough time to read the future while making sure the map
// doesn't grow unbounded.
for (auto it = impl->clientFailures.begin(); it != impl->clientFailures.end();) {
if (it->second.isReady()) {
it = impl->clientFailures.erase(it);
} else {
++it;
}
}
TraceEvent(SevDebug, "ConfigBroadcasterRegisteringWorker", impl->id)
.detail("ClientID", broadcastInterface.id())
.detail("MostRecentVersion", impl->mostRecentVersion)