@@ -18,7 +18,7 @@ import (
1818)
1919
2020func TestMaxCapacity (t * testing.T ) {
21- w := NewConsumer (WithQueueSize (2 ))
21+ w := NewRing (WithQueueSize (2 ))
2222
2323 assert .NoError (t , w .Queue (& mockMessage {}))
2424 assert .NoError (t , w .Queue (& mockMessage {}))
@@ -32,7 +32,7 @@ func TestCustomFuncAndWait(t *testing.T) {
3232 m := mockMessage {
3333 message : "foo" ,
3434 }
35- w := NewConsumer (
35+ w := NewRing (
3636 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
3737 time .Sleep (500 * time .Millisecond )
3838 return nil
@@ -61,7 +61,7 @@ func TestEnqueueJobAfterShutdown(t *testing.T) {
6161 m := mockMessage {
6262 message : "foo" ,
6363 }
64- w := NewConsumer ()
64+ w := NewRing ()
6565 q , err := NewQueue (
6666 WithWorker (w ),
6767 WithWorkerCount (2 ),
@@ -81,7 +81,7 @@ func TestJobReachTimeout(t *testing.T) {
8181 m := mockMessage {
8282 message : "foo" ,
8383 }
84- w := NewConsumer (
84+ w := NewRing (
8585 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
8686 for {
8787 select {
@@ -114,7 +114,7 @@ func TestCancelJobAfterShutdown(t *testing.T) {
114114 m := mockMessage {
115115 message : "foo" ,
116116 }
117- w := NewConsumer (
117+ w := NewRing (
118118 WithLogger (NewEmptyLogger ()),
119119 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
120120 for {
@@ -147,7 +147,7 @@ func TestCancelJobAfterShutdown(t *testing.T) {
147147}
148148
149149func TestGoroutineLeak (t * testing.T ) {
150- w := NewConsumer (
150+ w := NewRing (
151151 WithLogger (NewLogger ()),
152152 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
153153 for {
@@ -191,7 +191,7 @@ func TestGoroutinePanic(t *testing.T) {
191191 m := mockMessage {
192192 message : "foo" ,
193193 }
194- w := NewConsumer (
194+ w := NewRing (
195195 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
196196 panic ("missing something" )
197197 }),
@@ -208,7 +208,7 @@ func TestGoroutinePanic(t *testing.T) {
208208}
209209
210210func TestIncreaseWorkerCount (t * testing.T ) {
211- w := NewConsumer (
211+ w := NewRing (
212212 WithLogger (NewEmptyLogger ()),
213213 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
214214 time .Sleep (500 * time .Millisecond )
@@ -239,7 +239,7 @@ func TestIncreaseWorkerCount(t *testing.T) {
239239}
240240
241241func TestDecreaseWorkerCount (t * testing.T ) {
242- w := NewConsumer (
242+ w := NewRing (
243243 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
244244 time .Sleep (100 * time .Millisecond )
245245 return nil
@@ -270,13 +270,13 @@ func TestDecreaseWorkerCount(t *testing.T) {
270270 q .Release ()
271271}
272272
273- func TestHandleAllJobBeforeShutdownConsumer (t * testing.T ) {
273+ func TestHandleAllJobBeforeShutdownRing (t * testing.T ) {
274274 controller := gomock .NewController (t )
275275 defer controller .Finish ()
276276
277277 m := mocks .NewMockQueuedMessage (controller )
278278
279- w := NewConsumer (
279+ w := NewRing (
280280 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
281281 time .Sleep (10 * time .Millisecond )
282282 return nil
@@ -303,7 +303,7 @@ func TestHandleAllJobBeforeShutdownConsumer(t *testing.T) {
303303 <- done
304304}
305305
306- func TestHandleAllJobBeforeShutdownConsumerInQueue (t * testing.T ) {
306+ func TestHandleAllJobBeforeShutdownRingInQueue (t * testing.T ) {
307307 controller := gomock .NewController (t )
308308 defer controller .Finish ()
309309
@@ -312,7 +312,7 @@ func TestHandleAllJobBeforeShutdownConsumerInQueue(t *testing.T) {
312312
313313 messages := make (chan string , 10 )
314314
315- w := NewConsumer (
315+ w := NewRing (
316316 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
317317 time .Sleep (10 * time .Millisecond )
318318 messages <- string (m .Bytes ())
@@ -346,7 +346,7 @@ func TestRetryCountWithNewMessage(t *testing.T) {
346346 keep := make (chan struct {})
347347 count := 1
348348
349- w := NewConsumer (
349+ w := NewRing (
350350 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
351351 if count % 3 != 0 {
352352 count ++
@@ -384,7 +384,7 @@ func TestRetryCountWithNewTask(t *testing.T) {
384384 messages := make (chan string , 10 )
385385 count := 1
386386
387- w := NewConsumer ()
387+ w := NewRing ()
388388
389389 q , err := NewQueue (
390390 WithLogger (NewLogger ()),
@@ -422,7 +422,7 @@ func TestCancelRetryCountWithNewTask(t *testing.T) {
422422 messages := make (chan string , 10 )
423423 count := 1
424424
425- w := NewConsumer ()
425+ w := NewRing ()
426426
427427 q , err := NewQueue (
428428 WithLogger (NewLogger ()),
@@ -464,7 +464,7 @@ func TestCancelRetryCountWithNewMessage(t *testing.T) {
464464 messages := make (chan string , 10 )
465465 count := 1
466466
467- w := NewConsumer (
467+ w := NewRing (
468468 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
469469 if count % 3 != 0 {
470470 count ++
@@ -498,7 +498,7 @@ func TestCancelRetryCountWithNewMessage(t *testing.T) {
498498}
499499
500500func TestErrNoTaskInQueue (t * testing.T ) {
501- w := NewConsumer (
501+ w := NewRing (
502502 WithFn (func (ctx context.Context , m core.QueuedMessage ) error {
503503 return nil
504504 }),
0 commit comments