Browse Source

fix datarace on issue indexer queue (#9490)

tags/v1.11.0-rc1
Lunny Xiao 4 years ago
parent
commit
8b2f29c0d2
No account linked to committer's email address
2 changed files with 6 additions and 1 deletions
  1. 2
    0
      modules/indexer/code/indexer.go
  2. 4
    1
      modules/indexer/code/queue.go

+ 2
- 0
modules/indexer/code/indexer.go View File

@@ -38,6 +38,8 @@ func Init() {
return
}

initQueue(setting.Indexer.UpdateQueueLength)

ctx, cancel := context.WithCancel(context.Background())

graceful.GetManager().RunAtTerminate(ctx, func() {

+ 4
- 1
modules/indexer/code/queue.go View File

@@ -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