Skip to content

Commit

Permalink
[rest.li] Update SimpleLoadBalancer to use for loop instead of Map (#947
Browse files Browse the repository at this point in the history
)

* Update SimpleLoadBalancer.java

* Update CHANGELOG.md
  • Loading branch information
vshwnth2 authored Nov 27, 2023
1 parent a45e661 commit 299326f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ When updating the changelog, remember to be very clear about what behavior has c
and what APIs have changed, if applicable.

## [Unreleased]
## [29.48.1] - 2023-11-27
- Update SimpleLoadBalancer to use for loop instead of Map

## [29.48.0] - 2023-11-13
- Fix dual-read potential risk that newLb may impact oldLb

Expand Down Expand Up @@ -5562,7 +5565,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.48.0...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.48.1...master
[29.48.1]: https://github.com/linkedin/rest.li/compare/v29.48.0...v29.48.1
[29.48.0]: https://github.com/linkedin/rest.li/compare/v29.47.0...v29.48.0
[29.47.0]: https://github.com/linkedin/rest.li/compare/v29.46.9...v29.47.0
[29.46.9]: https://github.com/linkedin/rest.li/compare/v29.46.8...v29.46.9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,11 @@ private TrackerClientSubsetItem getPotentialClients(String serviceName,
}
else
{
Map<URI, Double> weightedUris = possibleUris.stream()
.collect(Collectors.toMap(
uri -> uri,
uri -> uris.getPartitionDataMap(uri).get(partitionId).getWeight()));
Map<URI, Double> weightedUris = new HashMap<>(possibleUris.size());
for (URI possibleUri : possibleUris)
{
weightedUris.put(possibleUri, uris.getPartitionDataMap(possibleUri).get(partitionId).getWeight());
}

SubsettingState.SubsetItem subsetItem = _state.getClientsSubset(serviceName,
serviceProperties.getMinClusterSubsetSize(), partitionId, weightedUris, version);
Expand Down

0 comments on commit 299326f

Please sign in to comment.