mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-10 02:31:39 +02:00
fix datarace on issue indexer queue (#9490)
This commit is contained in:
1 parent
f88715e29c
commit
8b2f29c0d2
2 files changed
+6
-1
No files matched your search
@@ -38,6 +38,8 @@ func Init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initQueue(setting.Indexer.UpdateQueueLength)
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
graceful.GetManager().RunAtTerminate(ctx, func() {
|
graceful.GetManager().RunAtTerminate(ctx, func() {
|
||||||
|
|||||||
@@ -21,8 +21,11 @@ type repoIndexerOperation struct {
|
|||||||
|
|
||||||
var repoIndexerOperationQueue chan repoIndexerOperation
|
var repoIndexerOperationQueue chan repoIndexerOperation
|
||||||
|
|
||||||
|
func initQueue(queueLength int) {
|
||||||
|
repoIndexerOperationQueue = make(chan repoIndexerOperation, queueLength)
|
||||||
|
}
|
||||||
|
|
||||||
func processRepoIndexerOperationQueue(indexer Indexer) {
|
func processRepoIndexerOperationQueue(indexer Indexer) {
|
||||||
repoIndexerOperationQueue = make(chan repoIndexerOperation, setting.Indexer.UpdateQueueLength)
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case op := <-repoIndexerOperationQueue:
|
case op := <-repoIndexerOperationQueue:
|
||||||
|
|||||||
Reference in new issue
Block a user