-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Switch to Single Redis Connection with Prefixed Keys #82
Conversation
WalkthroughThis update refines the Redis connection management within the Rust application. The change involves upgrading the Changes
Recent review detailsConfiguration used: CodeRabbit UI Files ignored due to path filters (1)
Files selected for processing (3)
Additional comments not posted (33)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
src/storage.rs (1)
Line range hint
116-141
:
Refactor: RedisConnection InitializationThe
new
method has been updated to establish a single connection. The logic includes handling the case where the Redis server is not running, which is a good practice. However, the sleep duration is a hack and should be addressed in the future.- // TODO: fix this hack - sleep(Duration::from_secs(5)); + // TODO: Replace sleep with a proper check to ensure the Redis server is ready. + for _ in 0..10 { + if try_client.get_connection().is_ok() { + break; + } + sleep(Duration::from_secs(1)); + }
Changes
RedisConnections
to use a single Redis connection instead of multiple connections for different logical databases.Motivation
This change simplifies our Redis usage and aligns with Redis Cloud's limitations, which don't support multiple databases. Using a single connection with prefixed keys provides better performance, reduces complexity in connection management, and maintains logical separation of different data types.
Key Prefixes
main:
for hashchain entriesderived:
for derived dictionary entriesapp_state:
for application state (epoch, epoch_operation)merkle_proofs:
for Merkle proofscommitments:
for epoch commitmentsinput_order
remains unprefixed as it's a global listcloses #73