1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 19:32:24 +08:00

race fix: pinner loads with a threadsafe datastore

All the datastores used by pinners and so on should be mutex
wrapped. One issue with changing all of them from
ds.Datastore -> ds.ThreadSafeDatastore is that we wrap the
incoming ds.ThreadSafeDatastore with other datastores, which
do not implement the interface. Re-wrapping again causes
double locking. (which may be ok..., but...) any ideas?
This commit is contained in:
Juan Batiz-Benet
2015-01-11 21:31:19 -08:00
parent 4af5d85fac
commit 16690d4af2
4 changed files with 9 additions and 9 deletions

View File

@ -137,8 +137,8 @@ type dagservAndPinner struct {
}
func getDagservAndPinner(t *testing.T) dagservAndPinner {
db := ds.NewMapDatastore()
bs := bstore.NewBlockstore(dssync.MutexWrap(db))
db := dssync.MutexWrap(ds.NewMapDatastore())
bs := bstore.NewBlockstore(db)
blockserv, err := bserv.New(bs, offline.Exchange(bs))
if err != nil {
t.Fatal(err)