1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-26 23:53:19 +08:00

fix(race condition)

https://github.com/jbenet/go-ipfs/issues/270
This commit is contained in:
Brian Tiger Chow
2014-11-05 08:38:26 -08:00
parent 3bc2281c51
commit de61d663b5

View File

@ -239,17 +239,17 @@ func TestFastRepublish(t *testing.T) {
} }
// constantly keep writing to the file // constantly keep writing to the file
go func() { go func(timeout time.Duration) {
for { for {
select { select {
case <-closed: case <-closed:
return return
case <-time.After(shortRepublishTimeout * 8 / 10): case <-time.After(timeout * 8 / 10):
writeFileData(t, dataB, fname) writeFileData(t, dataB, fname)
} }
} }
}() }(shortRepublishTimeout)
hasPublished := func() bool { hasPublished := func() bool {
res, err := node.Namesys.Resolve(pubkeyHash) res, err := node.Namesys.Resolve(pubkeyHash)