diff options
Diffstat (limited to 'modules/indexer')
-rw-r--r-- | modules/indexer/code/indexer.go | 2 | ||||
-rw-r--r-- | modules/indexer/code/queue.go | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/modules/indexer/code/indexer.go b/modules/indexer/code/indexer.go index 04d556f541..3f9461cd0e 100644 --- a/modules/indexer/code/indexer.go +++ b/modules/indexer/code/indexer.go @@ -38,6 +38,8 @@ func Init() { return } + initQueue(setting.Indexer.UpdateQueueLength) + ctx, cancel := context.WithCancel(context.Background()) graceful.GetManager().RunAtTerminate(ctx, func() { diff --git a/modules/indexer/code/queue.go b/modules/indexer/code/queue.go index 82cd8ded53..4eeb6ac7d4 100644 --- a/modules/indexer/code/queue.go +++ b/modules/indexer/code/queue.go @@ -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: |