Skip to content

Commit 8d75d3e

Browse files
authored
fix(worker): don't start request task (#60)
1 parent 1a06aab commit 8d75d3e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pool_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ func TestNewPoolWithQueueTask(t *testing.T) {
2828
p.Release()
2929
assert.Equal(t, 0, p.BusyWorkers())
3030
}
31+
32+
func TestPoolNumber(t *testing.T) {
33+
p := NewPool(0)
34+
p.Start()
35+
// shutdown all, and now running worker is 0
36+
p.Release()
37+
assert.Equal(t, 0, p.BusyWorkers())
38+
}

queue.go

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ func NewQueue(opts ...Option) (*Queue, error) {
8181

8282
// Start to enable all worker
8383
func (q *Queue) Start() {
84+
if q.workerCount == 0 {
85+
return
86+
}
8487
q.routineGroup.Run(func() {
8588
q.start()
8689
})

0 commit comments

Comments
 (0)