@@ -147,27 +147,27 @@ void TFederatedDbObserverImpl::OnFederationDiscovery(TStatus&& status, Ydb::Fede
147
147
FederatedDbState->DbInfos .emplace_back (std::move (db));
148
148
149
149
} else {
150
- if (!status.IsSuccess ()) {
150
+ if (status.IsSuccess ()) {
151
+ ScheduleFederationDiscoveryImpl (REDISCOVERY_DELAY);
152
+ } else {
153
+ LOG_LAZY (DbDriverState_->Log , TLOG_ERR, TStringBuilder ()
154
+ << " OnFederationDiscovery: Got error. Status: " << status.GetStatus ()
155
+ << " . Description: " << status.GetIssues ().ToOneLineString ());
151
156
if (!FederationDiscoveryRetryState) {
152
157
FederationDiscoveryRetryState = FederationDiscoveryRetryPolicy->CreateRetryState ();
153
158
}
154
159
155
- auto retryDelay = FederationDiscoveryRetryState->GetNextRetryDelay (status.GetStatus ());
156
-
157
- if (retryDelay) {
158
- ScheduleFederationDiscoveryImpl (*retryDelay);
160
+ if (auto d = FederationDiscoveryRetryState->GetNextRetryDelay (status.GetStatus ())) {
161
+ ScheduleFederationDiscoveryImpl (*d);
159
162
return ;
160
163
}
161
- // If retryDelay is Nothing, meaning there won't be another retry,
162
- // we replace FederatedDbState with the unsuccessful one and then set the PromiseToInitState if needed,
163
- // and the observer becomes stale (see IsStale method).
164
- } else {
165
- ScheduleFederationDiscoveryImpl (REDISCOVERY_DELAY);
164
+ // If there won't be another retry, we replace FederatedDbState with the unsuccessful one
165
+ // and set the PromiseToInitState to make the observer stale (see IsStale method).
166
166
}
167
167
168
168
// TODO validate new state and check if differs from previous
169
-
170
169
auto newInfo = std::make_shared<TFederatedDbState>(std::move (result), std::move (status));
170
+
171
171
// TODO update only if new state differs
172
172
std::swap (FederatedDbState, newInfo);
173
173
}
0 commit comments