Move mailer to use a queue (#9789)
* Move mailer to use a queue * Make sectionMap map[string]bool * Ensure that Message is json encodable
This commit is contained in:
parent
06cd3e03a2
commit
c76c70a16c
4 changed files with 102 additions and 63 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue