Skip to content

Commit fc0cada

Browse files
authored
chore(options): update default capacity as zero (#100)
1 parent c65a57a commit fc0cada

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

consumer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (s *Consumer) Queue(task core.QueuedMessage) error { //nolint:stylecheck
5252
if atomic.LoadInt32(&s.stopFlag) == 1 {
5353
return ErrQueueShutdown
5454
}
55-
if s.count >= s.capacity {
55+
if s.capacity > 0 && s.count >= s.capacity {
5656
return errMaxCapacity
5757
}
5858

options.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
var (
11-
defaultQueueSize = 4096
11+
defaultCapacity = 0
1212
defaultWorkerCount = runtime.NumCPU()
1313
defaultNewLogger = NewLogger()
1414
defaultFn = func(context.Context, core.QueuedMessage) error { return nil }
@@ -87,7 +87,7 @@ type Options struct {
8787
func NewOptions(opts ...Option) *Options {
8888
o := &Options{
8989
workerCount: defaultWorkerCount,
90-
queueSize: defaultQueueSize,
90+
queueSize: defaultCapacity,
9191
logger: defaultNewLogger,
9292
worker: nil,
9393
fn: defaultFn,

0 commit comments

Comments
 (0)