feat(sv-consumer): Ack on msg if block is already processed #489
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.
This pull request introduces changes to the
BlockExecutorimplementation in theservices/consumer/src/executor/block_executor.rsfile to enhance block processing logic. The key updates include adding a query mechanism to check for already processed blocks and ensuring proper semaphore management during block processing.Enhancements to block processing logic:
services/consumer/src/executor/block_executor.rs: Added theBlocksQuerytype to the imports to enable querying for blocks in the database.services/consumer/src/executor/block_executor.rs: Implemented a query mechanism usingBlocksQueryto check if a block has already been processed. If the block exists, the message is acknowledged, and the semaphore permit is released early to avoid redundant processing.Semaphore management improvement:
services/consumer/src/executor/block_executor.rs: Adjusted the semaphore release logic to ensure the permit is dropped immediately after the store operation is completed, improving resource management.