Skip to content

Commit 5a952b2

Browse files
committed
chore(simple): add default queue size
Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 871b188 commit 5a952b2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

simple/simple.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package simple
22

33
import (
44
"errors"
5-
"runtime"
65
"sync"
76

87
"github.com/appleboy/queue"
98
)
109

10+
const defaultQueueSize = 4096
11+
1112
var _ queue.Worker = (*Worker)(nil)
1213

1314
// Option for queue system
@@ -88,7 +89,7 @@ func WithRunFunc(fn func(queue.QueuedMessage, <-chan struct{}) error) Option {
8889
// NewWorker for struc
8990
func NewWorker(opts ...Option) *Worker {
9091
w := &Worker{
91-
queueNotification: make(chan queue.QueuedMessage, runtime.NumCPU()<<1),
92+
queueNotification: make(chan queue.QueuedMessage, defaultQueueSize),
9293
stop: make(chan struct{}),
9394
runFunc: func(queue.QueuedMessage, <-chan struct{}) error {
9495
return nil

0 commit comments

Comments
 (0)