File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed
openfeature-provider-local/src/main/java/com/spotify/confidence Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -167,23 +167,21 @@ private ResolveWithStickyRequest handleMissingMaterializations(
167167 } catch (InterruptedException | ExecutionException e ) {
168168 throw new RuntimeException (e );
169169 }
170- materializationPerUnitMap .put (
170+ materializationPerUnitMap .computeIfAbsent (
171171 unit ,
172- MaterializationMap .newBuilder ()
173- .putAllInfoMap (
174- loadedAssignments .entrySet ().stream ()
175- .collect (
176- Collectors .toMap (
177- Map .Entry ::getKey ,
178- e -> {
179- final var info = e .getValue ();
180- return com .spotify .confidence .flags .resolver .v1
181- .MaterializationInfo .newBuilder ()
182- .setUnitInInfo (info .isUnitInMaterialization ())
183- .putAllRuleToVariant (info .ruleToVariant ())
184- .build ();
185- })))
186- .build ());
172+ k -> MaterializationMap .newBuilder ().putAllInfoMap (new HashMap <>()).build ());
173+ materializationPerUnitMap .computeIfPresent (
174+ unit ,
175+ (k , v ) -> {
176+ final Map <
177+ String , com .spotify .confidence .flags .resolver .v1 .MaterializationInfo >
178+ map = new HashMap <>();
179+ loadedAssignments .forEach (
180+ (s , materializationInfo ) -> {
181+ map .put (s , materializationInfo .toProto ());
182+ });
183+ return v .toBuilder ().putAllInfoMap (map ).build ();
184+ });
187185 });
188186 });
189187
You can’t perform that action at this time.
0 commit comments