Skip to content

Commit 315d928

Browse files
authored
Fix Workerpool deadlock (#10283) (#10284)
* Prevent deadlock on boost * Force a boost in testchannelqueue
1 parent 5525452 commit 315d928

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

modules/queue/queue_channel_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ func TestChannelQueue(t *testing.T) {
2525

2626
queue, err := NewChannelQueue(handle,
2727
ChannelQueueConfiguration{
28-
QueueLength: 20,
29-
Workers: 1,
28+
QueueLength: 0,
3029
MaxWorkers: 10,
3130
BlockTimeout: 1 * time.Second,
3231
BoostTimeout: 5 * time.Minute,
3332
BoostWorkers: 5,
33+
Workers: 0,
34+
Name: "TestChannelQueue",
3435
}, &testData{})
3536
assert.NoError(t, err)
3637

modules/queue/workerpool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ func (p *WorkerPool) pushBoost(data Data) {
9696
p.blockTimeout /= 2
9797
p.lock.Unlock()
9898
}()
99-
p.addWorkers(ctx, boost)
10099
p.lock.Unlock()
100+
p.addWorkers(ctx, boost)
101101
p.dataChan <- data
102102
}
103103
}

0 commit comments

Comments
 (0)