Skip to content
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

chain head listener: Reduce locking #2763

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

leoyvens
Copy link
Collaborator

In hosted a subgraph was observed to hang in new_block_stream, which could mean hanging in ChainHeadListener::subscribe, so this lock might be involved. This switches the Mutex to an RwLock which will only see write locks when the networks are first inserted, so it practically removes contention. This should at least reduce the impact of a task hanging while holding the lock. The implementation is basically what it was before #2366, but being mindful of race conditions.

@leoyvens leoyvens force-pushed the leo/optimize-chain-head-listener-lock branch 3 times, most recently from 484ed12 to e9ed1d7 Compare August 31, 2021 15:33
@leoyvens leoyvens force-pushed the leo/optimize-chain-head-listener-lock branch from e9ed1d7 to 392d167 Compare August 31, 2021 15:34
@leoyvens leoyvens merged commit 592a6ac into master Aug 31, 2021
@leoyvens leoyvens deleted the leo/optimize-chain-head-listener-lock branch August 31, 2021 18:53
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.

None yet

2 participants