From 2d460062c97f9ad1e793831c54ae4d177dea83e8 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Wed, 11 Aug 2021 22:03:34 +0300 Subject: Durable requeue algo. Update AMQP and Beanstalk tests to use mock logger. Fix bugs discovered during testing. Signed-off-by: Valery Piashchynski --- pkg/priority_queue/binary_heap_test.go | 2 ++ pkg/priority_queue/interface.go | 3 +++ 2 files changed, 5 insertions(+) (limited to 'pkg/priority_queue') diff --git a/pkg/priority_queue/binary_heap_test.go b/pkg/priority_queue/binary_heap_test.go index fb5b83de..05ddf5ef 100644 --- a/pkg/priority_queue/binary_heap_test.go +++ b/pkg/priority_queue/binary_heap_test.go @@ -40,6 +40,8 @@ func (t Test) Priority() int64 { return int64(t) } +func (t Test) Recycle() {} + 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)} diff --git a/pkg/priority_queue/interface.go b/pkg/priority_queue/interface.go index 9efa4652..0034cbd3 100644 --- a/pkg/priority_queue/interface.go +++ b/pkg/priority_queue/interface.go @@ -28,4 +28,7 @@ type Item interface { // Requeue - put the message back to the queue with the optional delay Requeue(headers map[string][]string, delay int64) error + + // Recycle frees resources allocated by the Item + Recycle() } -- cgit v1.2.3