diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-07-19 03:59:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-18 21:59:10 +0200 |
commit | 43262226db0b7280f80ce02a4643ab826510293b (patch) | |
tree | edcf02f9e8ab6917aabfdd55c003b45b2f9cb719 /modules/indexer/issues/bleve.go | |
parent | bb7a7c4292f9c4478a45109a745da94d1d6ad414 (diff) | |
download | gitea-43262226db0b7280f80ce02a4643ab826510293b.tar.gz gitea-43262226db0b7280f80ce02a4643ab826510293b.zip |
Fix data race in bleve indexer (#16474)
* Fix data race in bleve indexer
Diffstat (limited to 'modules/indexer/issues/bleve.go')
-rw-r--r-- | modules/indexer/issues/bleve.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/indexer/issues/bleve.go b/modules/indexer/issues/bleve.go index b1385eb676..db12874e84 100644 --- a/modules/indexer/issues/bleve.go +++ b/modules/indexer/issues/bleve.go @@ -9,8 +9,10 @@ import ( "os" "strconv" + gitea_bleve "code.gitea.io/gitea/modules/indexer/bleve" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/util" + "github.com/blevesearch/bleve/v2" "github.com/blevesearch/bleve/v2/analysis/analyzer/custom" "github.com/blevesearch/bleve/v2/analysis/token/lowercase" @@ -197,7 +199,7 @@ func (b *BleveIndexer) Close() { // Index will save the index data func (b *BleveIndexer) Index(issues []*IndexerData) error { - batch := rupture.NewFlushingBatch(b.indexer, maxBatchSize) + batch := gitea_bleve.NewFlushingBatch(b.indexer, maxBatchSize) for _, issue := range issues { if err := batch.Index(indexerID(issue.ID), struct { RepoID int64 @@ -218,7 +220,7 @@ func (b *BleveIndexer) Index(issues []*IndexerData) error { // Delete deletes indexes by ids func (b *BleveIndexer) Delete(ids ...int64) error { - batch := rupture.NewFlushingBatch(b.indexer, maxBatchSize) + batch := gitea_bleve.NewFlushingBatch(b.indexer, maxBatchSize) for _, id := range ids { if err := batch.Delete(indexerID(id)); err != nil { return err |