Commit 559d20fd authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

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?
parent cdd736c9
...@@ -28,8 +28,8 @@ type dagservAndPinner struct { ...@@ -28,8 +28,8 @@ type dagservAndPinner struct {
} }
func getDagservAndPinner(t *testing.T) dagservAndPinner { func getDagservAndPinner(t *testing.T) dagservAndPinner {
db := ds.NewMapDatastore() db := dssync.MutexWrap(ds.NewMapDatastore())
bs := bstore.NewBlockstore(dssync.MutexWrap(db)) bs := bstore.NewBlockstore(db)
blockserv, err := bserv.New(bs, offline.Exchange(bs)) blockserv, err := bserv.New(bs, offline.Exchange(bs))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment