Skip to content

Conversation

@sttk
Copy link
Owner

@sttk sttk commented Aug 23, 2025

This PR adds implementations for two new methods to RedisDataConn: pre_commit and post_commit. Together with force_back, these methods provide a way to maintain data consistency in Redis, even though it lacks a rollback feature, when updating it alongside other databases within a transaction.

Also, I changed the argument for add_force_back from a function pointer to FnMut so that it can capture variables from the environment where the function is defined. The same applies to add_pre_commit and add_post_commit.

@sttk sttk requested review from Copilot and removed request for Copilot August 23, 2025 01:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds implementations for pre_commit and post_commit methods to RedisDataConn to provide better transactional consistency when using Redis alongside other databases. These methods enable Redis operations to be executed at specific points in the transaction lifecycle to maintain data consistency despite Redis's lack of native rollback support.

  • Added pre_commit method that executes operations after other database updates but before their commits
  • Added post_commit method that executes operations after transaction completion
  • Changed function pointer types from fn to FnMut closures to allow capturing environment variables

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sttk sttk requested review from Copilot and removed request for Copilot August 23, 2025 02:17
@sttk sttk merged commit f6f8824 into main Aug 23, 2025
3 checks passed
@sttk sttk deleted the add_pre_commit_and_post_commit branch August 23, 2025 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants