- Add godoc documentation.
This commit is contained in:
@@ -43,7 +43,7 @@ func TestBasicQueue(t *testing.T) {
|
||||
|
||||
q.HandleParallel(ctx, 1)
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := range 10 {
|
||||
q.Produce(Task{ID: i})
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func TestParallelProcessing(t *testing.T) {
|
||||
|
||||
q.HandleParallel(ctx, 4)
|
||||
|
||||
for i := 0; i < 20; i++ {
|
||||
for i := range 20 {
|
||||
q.Produce(Task{ID: i})
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ func TestGracefulShutdown(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
q.HandleParallel(ctx, 2)
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := range 10 {
|
||||
q.Produce(Task{ID: i})
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ func TestDLQ(t *testing.T) {
|
||||
dlq.HandleParallel(ctx, 1)
|
||||
|
||||
// Отправляем 10 задач
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := range 10 {
|
||||
mainQ.Produce(Task{ID: i})
|
||||
}
|
||||
|
||||
@@ -233,10 +233,10 @@ func TestHooks(t *testing.T) {
|
||||
q := queue.NewQueue[Task](10)
|
||||
|
||||
var produced, handled, dropped int32
|
||||
q.SetHooks(queue.QueueHooks{
|
||||
q.SetHooks(queue.QueueHooks[Task]{
|
||||
OnProduced: func() { atomic.AddInt32(&produced, 1) },
|
||||
OnHandled: func() { atomic.AddInt32(&handled, 1) },
|
||||
OnDropped: func(_ interface{}) { atomic.AddInt32(&dropped, 1) },
|
||||
OnDropped: func(_ Task) { atomic.AddInt32(&dropped, 1) },
|
||||
})
|
||||
|
||||
q.Register(func(t Task) {})
|
||||
|
||||
Reference in New Issue
Block a user