Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor mget method improved readability and efficiency #3061

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ori0o0p
Copy link

@ori0o0p ori0o0p commented Nov 25, 2024

Related Feature Request

Relates to feature request: [Improve mget method implementation using Java 8 Streams]

Description

This PR refactors the mget method in RedisAdvancedClusterReactiveCommandsImpl.java to improve code readability and maintainability by utilizing Java 8 Streams and reactive programming patterns.

Current Implementation Issues

  • Uses manual for loops to build publisher list
  • Complex nested iteration structure
  • Less readable code for handling partitioned data
  • Uses flatMapIterable instead of more idiomatic reactive approach

Proposed Changes

  • Replaced manual publisher list creation with Stream API
  • Simplified partition handling using functional approach
  • Improved reactive chain using flatMapMany(Flux::fromIterable)
  • Maintained same functionality with cleaner implementation

Implementation Details

  • Replaced for loop with partitioned.values().stream().map(super::mget)
  • Streamlined result processing using reactive chain
  • Maintained backward compatibility with existing API
  • No changes to public interfaces

closes #3060

@tishun
Copy link
Collaborator

tishun commented Dec 1, 2024

@ori0o0p thanks for this PR.

Could you format your code using mvn formatter:format ?

@ori0o0p ori0o0p force-pushed the refactor-reactive-mget-method branch from 06a7c31 to 74705da Compare December 2, 2024 11:56
@ori0o0p
Copy link
Author

ori0o0p commented Dec 2, 2024

I've got it formatted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants