refactor(RemoteServicesInspector): simplify getServicesInfo using List and plain loop#1025
refactor(RemoteServicesInspector): simplify getServicesInfo using List and plain loop#1025freddidierRTE wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesRemote Service Inspection
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Pull request overview
This PR refactors RemoteServicesInspector#getServicesInfo to simplify the async aggregation of /actuator/info responses across remote services, reducing generics/stream complexity while keeping the existing “partial results” behavior (NullNode-based detection) and improving debug logging.
Changes:
- Replace the raw
CompletableFuture[]+ unchecked cast with aList<CompletableFuture<...>>and a plain loop to collect results. - Remove
parallelStream()/AtomicBooleanin favor of sequential stream + simple boolean flag tracking. - Parameterize the SLF4J
LOGGER.debugmessage to avoid eager string concatenation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
code OK |
…t and plain loop - Replace the raw CompletableFuture array with a List<CompletableFuture> to avoid the unchecked cast workaround and the need for the @SuppressWarnings annotation. - The parallel stream was replaced by a sequential stream since parallelism is already handled by the async CompletableFuture calls themselves; using parallelStream() on the mapping step brought no real benefit here. - The AtomicBoolean used to track partial results across a lambda is replaced by a plain boolean, improving readability now that the result collection is done in a standard for-loop. - The PartialResultException is now thrown with the result HashMap directly, removing a redundant defensive copy (new HashMap<>(result)). - Also fix a minor logging issue: replace string concatenation in the LOGGER.debug call with a parameterized message pattern {} to align with SLF4J best practices and avoid unnecessary string construction when debug logging is disabled.efacto getServiceInfo Signed-off-by: freddidierRTE <[email protected]>



PR Summary
Replace the raw CompletableFuture array with a List to avoid the unchecked cast workaround and the need for the @SuppressWarnings annotation.
The parallel stream was replaced by a sequential stream since parallelism is already handled by the async CompletableFuture calls themselves; using parallelStream() on the mapping step brought no real benefit here.
The AtomicBoolean used to track partial results across a lambda is replaced by a plain boolean, improving readability now that the result collection is done in a standard for-loop.
The PartialResultException is now thrown with the result HashMap directly, removing a redundant defensive copy (new HashMap<>(result)).
Also fix a minor logging issue: replace string concatenation in the LOGGER.debug call with a parameterized message pattern {} to align with SLF4J best practices and avoid unnecessary string construction when debug logging is disabled.efacto getServiceInfo