1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 01:54:26 +00:00

Fix Workerpool deadlock (#10283) (#10284)

* Prevent deadlock on boost

* Force a boost in testchannelqueue
This commit is contained in:
zeripath 2020-02-15 19:28:25 +00:00 committed by GitHub
parent 5525452bdf
commit 315d928626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -25,12 +25,13 @@ func TestChannelQueue(t *testing.T) {
queue, err := NewChannelQueue(handle,
ChannelQueueConfiguration{
QueueLength: 20,
Workers: 1,
QueueLength: 0,
MaxWorkers: 10,
BlockTimeout: 1 * time.Second,
BoostTimeout: 5 * time.Minute,
BoostWorkers: 5,
Workers: 0,
Name: "TestChannelQueue",
}, &testData{})
assert.NoError(t, err)

View File

@ -96,8 +96,8 @@ func (p *WorkerPool) pushBoost(data Data) {
p.blockTimeout /= 2
p.lock.Unlock()
}()
p.addWorkers(ctx, boost)
p.lock.Unlock()
p.addWorkers(ctx, boost)
p.dataChan <- data
}
}