Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Make node manager locks RwLocks #1010

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Make node manager locks RwLocks #1010

merged 1 commit into from
Feb 6, 2024

Conversation

benthecarman
Copy link
Collaborator

Closes #925

Pulled out from #1002

This was breaking tests in the above PR because the syncing background thread would block us from making other calls (ie get balance). This fixes by putting it in a RwLock instead of in a generic Mutex as well as making us drop the lock after reading the nodes we are gonna sync instead of holding it during the entire sync duration

Comment on lines +1101 to +1105
// get nodes hashmap, immediately drop lock because sync can take a while
let nodes = {
let nodes = self.nodes.read().await;
nodes.deref().clone()
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the main change that fixed the issue

@benthecarman benthecarman merged commit 10e197e into master Feb 6, 2024
9 checks passed
@benthecarman benthecarman deleted the ldk-sync-lock branch February 6, 2024 00:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find other places we can use async RwLock
2 participants