fix datarace on issue indexer queue (#9490)

tokarchuk/v1.17
Lunny Xiao 5 years ago committed by GitHub
parent f88715e29c
commit 8b2f29c0d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/indexer/code/indexer.go
  2. 5
      modules/indexer/code/queue.go

@ -38,6 +38,8 @@ func Init() {
return
}
initQueue(setting.Indexer.UpdateQueueLength)
ctx, cancel := context.WithCancel(context.Background())
graceful.GetManager().RunAtTerminate(ctx, func() {

@ -21,8 +21,11 @@ type repoIndexerOperation struct {
var repoIndexerOperationQueue chan repoIndexerOperation
func initQueue(queueLength int) {
repoIndexerOperationQueue = make(chan repoIndexerOperation, queueLength)
}
func processRepoIndexerOperationQueue(indexer Indexer) {
repoIndexerOperationQueue = make(chan repoIndexerOperation, setting.Indexer.UpdateQueueLength)
for {
select {
case op := <-repoIndexerOperationQueue:

Loading…
Cancel
Save