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
fix: limit scope of stacks_rw_db usage to free lock #543
Conversation
42b93d2
to
5d15171
Compare
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.
At first, I thought the code could be simplified. However, upon closer inspection, I noticed that the data
struct differs between StacksChainEvent::ChainUpdatedWithBlocks
and StacksChainEvent::ChainUpdatedWithReorg
. As a result, a more effective code reorganization is possible, but it would require deeper changes that are beyond the scope of this pull request.
Code LGTM, just a small change on the error message.
Every 32 stacks blocks, Chainhook attempts to check for a new archive file to fix any potential holes in the database. This process requires readwrite access to the stacks.rocksdb. However, the process that called this subprocess already had a readwrite instance of the database open, which was preventing the lock from being cleared. This PR sets the scope of the initial usage of the db in order to free up the lock.
Every 32 stacks blocks, Chainhook attempts to check for a new archive file to fix any potential holes in the database. This process requires readwrite access to the stacks.rocksdb. However, the process that called this subprocess already had a readwrite instance of the database open, which was preventing the lock from being cleared.
This PR sets the scope of the initial usage of the db in order to free up the lock.
Fixes #518