Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *Consumer) Queue(task core.QueuedMessage) error { //nolint:stylecheck
if atomic.LoadInt32(&s.stopFlag) == 1 {
return ErrQueueShutdown
}
if s.count >= s.capacity {
if s.capacity > 0 && s.count >= s.capacity {
return errMaxCapacity
}

Expand Down
4 changes: 2 additions & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var (
defaultQueueSize = 4096
defaultCapacity = 0
defaultWorkerCount = runtime.NumCPU()
defaultNewLogger = NewLogger()
defaultFn = func(context.Context, core.QueuedMessage) error { return nil }
Expand Down Expand Up @@ -87,7 +87,7 @@ type Options struct {
func NewOptions(opts ...Option) *Options {
o := &Options{
workerCount: defaultWorkerCount,
queueSize: defaultQueueSize,
queueSize: defaultCapacity,
logger: defaultNewLogger,
worker: nil,
fn: defaultFn,
Expand Down