diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-12-17 03:53:02 -0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-12-17 13:53:02 +0200 |
commit | 6abfa48c0ecb9f19cb5b6c66763dbd577ac21dcc (patch) | |
tree | 7eef9b7dfccaa99be927b938b373337e966295e1 /models/issue_indexer.go | |
parent | eb2b4df0ed258fc63108b272dda43b306ac25cce (diff) | |
download | gitea-6abfa48c0ecb9f19cb5b6c66763dbd577ac21dcc.tar.gz gitea-6abfa48c0ecb9f19cb5b6c66763dbd577ac21dcc.zip |
Remove unnecessary updates to issue indexer (#3212)
Diffstat (limited to 'models/issue_indexer.go')
-rw-r--r-- | models/issue_indexer.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/models/issue_indexer.go b/models/issue_indexer.go index c50b733492..3a2ad157c3 100644 --- a/models/issue_indexer.go +++ b/models/issue_indexer.go @@ -102,6 +102,26 @@ func (issue *Issue) update() indexer.IssueIndexerUpdate { } } +// updateNeededCols whether a change to the specified columns requires updating +// the issue indexer +func updateNeededCols(cols []string) bool { + for _, col := range cols { + switch col { + case "name", "content": + return true + } + } + return false +} + +// UpdateIssueIndexerCols update an issue in the issue indexer, given changes +// to the specified columns +func UpdateIssueIndexerCols(issueID int64, cols ...string) { + if updateNeededCols(cols) { + UpdateIssueIndexer(issueID) + } +} + // UpdateIssueIndexer add/update an issue to the issue indexer func UpdateIssueIndexer(issueID int64) { select { |