File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 88)
99
1010var (
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 {
8787func 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 ,
You can’t perform that action at this time.
0 commit comments