diff options
Diffstat (limited to 'modules/setting')
-rw-r--r-- | modules/setting/queue.go | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/modules/setting/queue.go b/modules/setting/queue.go index c91ff55acd..8c07685855 100644 --- a/modules/setting/queue.go +++ b/modules/setting/queue.go @@ -103,11 +103,11 @@ func NewQueueService() { // Now handle the old issue_indexer configuration section := Cfg.Section("queue.issue_indexer") - issueIndexerSectionMap := map[string]string{} + sectionMap := map[string]bool{} for _, key := range section.Keys() { - issueIndexerSectionMap[key.Name()] = key.Value() + sectionMap[key.Name()] = true } - if _, ok := issueIndexerSectionMap["TYPE"]; !ok { + if _, ok := sectionMap["TYPE"]; !ok { switch Indexer.IssueQueueType { case LevelQueueType: section.Key("TYPE").SetValue("level") @@ -120,18 +120,28 @@ func NewQueueService() { Indexer.IssueQueueType) } } - if _, ok := issueIndexerSectionMap["LENGTH"]; !ok { + if _, ok := sectionMap["LENGTH"]; !ok { section.Key("LENGTH").SetValue(fmt.Sprintf("%d", Indexer.UpdateQueueLength)) } - if _, ok := issueIndexerSectionMap["BATCH_LENGTH"]; !ok { + if _, ok := sectionMap["BATCH_LENGTH"]; !ok { section.Key("BATCH_LENGTH").SetValue(fmt.Sprintf("%d", Indexer.IssueQueueBatchNumber)) } - if _, ok := issueIndexerSectionMap["DATADIR"]; !ok { + if _, ok := sectionMap["DATADIR"]; !ok { section.Key("DATADIR").SetValue(Indexer.IssueQueueDir) } - if _, ok := issueIndexerSectionMap["CONN_STR"]; !ok { + if _, ok := sectionMap["CONN_STR"]; !ok { section.Key("CONN_STR").SetValue(Indexer.IssueQueueConnStr) } + + // Handle the old mailer configuration + section = Cfg.Section("queue.mailer") + sectionMap = map[string]bool{} + for _, key := range section.Keys() { + sectionMap[key.Name()] = true + } + if _, ok := sectionMap["LENGTH"]; !ok { + section.Key("LENGTH").SetValue(fmt.Sprintf("%d", Cfg.Section("mailer").Key("SEND_BUFFER_LEN").MustInt(100))) + } } // ParseQueueConnStr parses a queue connection string |