@@ -186,11 +186,19 @@ AllFlagsState ClientImpl::AllFlagsState(Context const& context,
186186 std::unordered_map<Client::FlagKey, Value> result;
187187
188188 if (!Initialized ()) {
189- LD_LOG (logger_, LogLevel::kWarn )
190- << " AllFlagsState() called before client has finished "
191- " initializing. Data source not available. Returning empty state" ;
189+ if (data_system_->CanEvaluateWhenNotInitialized ()) {
190+ LD_LOG (logger_, LogLevel::kWarn )
191+ << " AllFlagsState() called before LaunchDarkly client "
192+ " initialization completed; using last known values "
193+ " from data store" ;
194+ } else {
195+ LD_LOG (logger_, LogLevel::kWarn )
196+ << " AllFlagsState() called before client has finished "
197+ " initializing. Data source not available. Returning "
198+ " empty state" ;
192199
193- return {};
200+ return {};
201+ }
194202 }
195203
196204 AllFlagsStateBuilder builder{options};
@@ -418,7 +426,16 @@ EvaluationDetail<Value> ClientImpl::VariationInternal(
418426std::optional<enum EvaluationReason::ErrorKind> ClientImpl::PreEvaluationChecks (
419427 Context const & context) const {
420428 if (!Initialized ()) {
421- return EvaluationReason::ErrorKind::kClientNotReady ;
429+ if (data_system_->CanEvaluateWhenNotInitialized ()) {
430+ LD_LOG (logger_, LogLevel::kWarn )
431+ << " Evaluation called before LaunchDarkly client "
432+ " initialization completed; using last known values "
433+ " from data store. The $inited key was not found in "
434+ " the store; typically a Relay Proxy or other SDK "
435+ " should set this key." ;
436+ } else {
437+ return EvaluationReason::ErrorKind::kClientNotReady ;
438+ }
422439 }
423440 if (!context.Valid ()) {
424441 return EvaluationReason::ErrorKind::kUserNotSpecified ;
0 commit comments