mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 00:46:30 +00:00
Solve race condition in fifo.process
This commit is contained in:
parent
b7a6e6bd37
commit
1ffc4ded4e
2 changed files with 6 additions and 6 deletions
6
Makefile
6
Makefile
|
@ -21,13 +21,13 @@ format:
|
||||||
@gofmt -w ${GOFILES_NOVENDOR}
|
@gofmt -w ${GOFILES_NOVENDOR}
|
||||||
|
|
||||||
test-agent:
|
test-agent:
|
||||||
$(DOCKER_RUN) go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/)
|
$(DOCKER_RUN) go test -race -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/)
|
||||||
|
|
||||||
test-server:
|
test-server:
|
||||||
$(DOCKER_RUN) go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-server
|
$(DOCKER_RUN) go test -race -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-server
|
||||||
|
|
||||||
test-lib:
|
test-lib:
|
||||||
$(DOCKER_RUN) go test -timeout 30s $(shell go list ./... | grep -v '/cmd/')
|
$(DOCKER_RUN) go test -race -timeout 30s $(shell go list ./... | grep -v '/cmd/')
|
||||||
|
|
||||||
test: test-lib test-agent test-server
|
test: test-lib test-agent test-server
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,9 @@ func (q *fifo) Resume() {
|
||||||
// helper function that loops through the queue and attempts to
|
// helper function that loops through the queue and attempts to
|
||||||
// match the item to a single subscriber.
|
// match the item to a single subscriber.
|
||||||
func (q *fifo) process() {
|
func (q *fifo) process() {
|
||||||
|
q.Lock()
|
||||||
|
defer q.Unlock()
|
||||||
|
|
||||||
if q.paused {
|
if q.paused {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -238,9 +241,6 @@ func (q *fifo) process() {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
q.Lock()
|
|
||||||
defer q.Unlock()
|
|
||||||
|
|
||||||
q.resubmitExpiredBuilds()
|
q.resubmitExpiredBuilds()
|
||||||
q.filterWaiting()
|
q.filterWaiting()
|
||||||
for pending, worker := q.assignToWorker(); pending != nil && worker != nil; pending, worker = q.assignToWorker() {
|
for pending, worker := q.assignToWorker(); pending != nil && worker != nil; pending, worker = q.assignToWorker() {
|
||||||
|
|
Loading…
Reference in a new issue