internal/sync2: fix file handle leak (#1124)
This commit is contained in:
parent
f5b1e77cf2
commit
78b0414e6c
@ -78,7 +78,7 @@ func (file offsetFile) WriteAt(data []byte, at int64) (amount int, err error) {
|
||||
func (file offsetFile) Close() error {
|
||||
if atomic.AddInt64(file.open, -1) == 0 {
|
||||
return errs.Combine(
|
||||
file.Close(),
|
||||
file.file.Close(),
|
||||
os.Remove(file.file.Name()),
|
||||
)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ package kademlia
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@ -326,7 +325,6 @@ func TestDetermineFurthestIDWithinK(t *testing.T) {
|
||||
nodes, err := rt.nodeBucketDB.List(nil, 0)
|
||||
assert.NoError(t, err)
|
||||
furthest := rt.determineFurthestIDWithinK(teststorj.NodeIDsFromBytes(nodes.ByteSlices()...))
|
||||
fmt.Println(furthest.Bytes())
|
||||
assert.Equal(t, c.expectedFurthest, furthest[:2])
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user