summaryrefslogtreecommitdiff
path: root/pkg/priorityqueue/binary_heap_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-07-08 09:05:15 +0300
committerValery Piashchynski <[email protected]>2021-07-08 09:05:15 +0300
commitbb7b6a4d1821b36804f5d5756144ae42ad92b13e (patch)
tree351ed632680ef9525dbba17ebe20f4118f57ab5a /pkg/priorityqueue/binary_heap_test.go
parentb84a7cb26c184b709f18d3d52925b31d49351c03 (diff)
Add length limiter for the binary heaps data structure. After max length
reached, insert operation will be blocked until all pending messages have been fully consumed. Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/priorityqueue/binary_heap_test.go')
-rw-r--r--pkg/priorityqueue/binary_heap_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/priorityqueue/binary_heap_test.go b/pkg/priorityqueue/binary_heap_test.go
index b02017b6..dadc3a39 100644
--- a/pkg/priorityqueue/binary_heap_test.go
+++ b/pkg/priorityqueue/binary_heap_test.go
@@ -37,7 +37,7 @@ func (t Test) Priority() uint64 {
func TestBinHeap_Init(t *testing.T) {
a := []Item{Test(2), Test(23), Test(33), Test(44), Test(1), Test(2), Test(2), Test(2), Test(4), Test(6), Test(99)}
- bh := NewBinHeap()
+ bh := NewBinHeap(100)
for i := 0; i < len(a); i++ {
bh.Insert(a[i])
@@ -59,7 +59,7 @@ func TestNewPriorityQueue(t *testing.T) {
insertsPerSec := uint64(0)
getPerSec := uint64(0)
stopCh := make(chan struct{}, 1)
- pq := NewBinHeap()
+ pq := NewBinHeap(100)
go func() {
tt := time.NewTicker(time.Second)