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

prevent closing concurrently with other operations. #42

Merged
merged 1 commit into from Feb 25, 2020

Conversation

willscott
Copy link
Contributor

Add a sync.RWMutex protecting the Close operation.
Follows the same pattern as in go-ds-badger.
Address #29 / ipfs/kubo#6880

Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this. Left a couple comments to look into.

datastore.go Outdated Show resolved Hide resolved
ds_test.go Show resolved Hide resolved
datastore.go Outdated Show resolved Hide resolved
@willscott willscott marked this pull request as ready for review February 21, 2020 21:57
datastore.go Show resolved Hide resolved
datastore.go Outdated Show resolved Hide resolved
datastore.go Outdated Show resolved Hide resolved
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

LGTM with one thing to check. Merge when you've either locked on i.Release() or have confirmed that this isn't an issue (and left a comment in the code?).

datastore.go Show resolved Hide resolved
datastore.go Outdated Show resolved Hide resolved
Add a `sync.RWMutex` protecting the Close operation.
Follows the same pattern as in go-ds-badger.
Address #29 / ipfs/kubo#6880
@willscott willscott merged commit 8e15c83 into master Feb 25, 2020
@willscott willscott deleted the bug/race-close branch February 25, 2020 16:19
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

3 participants