Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dsqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ func (q *DSQueue) GetN(n int) ([][]byte, error) {
if n == 0 {
return nil, nil
}
rsp := make(chan getResponse)
// Buffer response channel so write can happen even if reader gone.
rsp := make(chan getResponse, 1)
req := getRequest{
n: n,
rsp: rsp,
Expand Down
4 changes: 2 additions & 2 deletions dsqueue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func BenchmarkGetN(b *testing.B) {
queue := dsqueue.New(ds, dsqName, dsqueue.WithDedupCacheSize(0))
defer queue.Close()

cids := random.Cids(25)
cids := random.Cids(64)

b.ResetTimer()
b.ReportAllocs()
Expand All @@ -423,7 +423,7 @@ func BenchmarkGetN(b *testing.B) {
queue.Put(c.Bytes())
}

outItems, err := queue.GetN(50)
outItems, err := queue.GetN(100)
if err != nil {
b.Fatal(err)
}
Expand Down
Loading