fix: Fix delete condition method #216
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Update Delete Method to be Asynchronous and Improve Group Removal Logic
Description
This pull request updates the
deletemethod in the chat action base class to be asynchronous, aligning it with the asynchronous nature of the application and improving overall performance. Additionally, it refactors the group removal logic to ensure that groups are only removed when appropriate, handling edge cases where conditions might prevent immediate deletion.Checklist
Before submitting your pull request, please ensure the following:
Changes
The following changes have been made:
deletemethod in backend/core/src/core/actions/chat/base.py to beasync, enabling non-blocking database operations.nft.pyandrule/base.pyfactories to support new test requirements.backend/docker-compose.dev.ymlto support the changes.How Has This Been Tested?
I tested these changes by running the newly created unit tests and existing related tests:
pytest backend/tests/unit/core/actions/chat/rule/test_blockchain_delete.pyto verify the new deletion logic.pytest backend/tests/unit/core/actions/chat/rule/test_blockchain.pyto ensure no regressions in existing blockchain rule functionality.Additional Notes
The shift to async delete might require updates in other parts of the system if they rely on the synchronous behavior of the delete action, though this PR attempts to cover the immediate dependencies.