summaryrefslogtreecommitdiffstats
path: root/modules/setting/task.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/setting/task.go')
-rw-r--r--modules/setting/task.go27
1 files changed, 10 insertions, 17 deletions
diff --git a/modules/setting/task.go b/modules/setting/task.go
index 97704d4a4d..81ed39a9fb 100644
--- a/modules/setting/task.go
+++ b/modules/setting/task.go
@@ -4,22 +4,15 @@
package setting
-var (
- // Task settings
- Task = struct {
- QueueType string
- QueueLength int
- QueueConnStr string
- }{
- QueueType: ChannelQueueType,
- QueueLength: 1000,
- QueueConnStr: "addrs=127.0.0.1:6379 db=0",
- }
-)
-
func newTaskService() {
- sec := Cfg.Section("task")
- Task.QueueType = sec.Key("QUEUE_TYPE").MustString(ChannelQueueType)
- Task.QueueLength = sec.Key("QUEUE_LENGTH").MustInt(1000)
- Task.QueueConnStr = sec.Key("QUEUE_CONN_STR").MustString("addrs=127.0.0.1:6379 db=0")
+ taskSec := Cfg.Section("task")
+ queueTaskSec := Cfg.Section("queue.task")
+ switch taskSec.Key("QUEUE_TYPE").MustString(ChannelQueueType) {
+ case ChannelQueueType:
+ queueTaskSec.Key("TYPE").MustString("persistable-channel")
+ case RedisQueueType:
+ queueTaskSec.Key("TYPE").MustString("redis")
+ }
+ queueTaskSec.Key("LENGTH").MustInt(taskSec.Key("QUEUE_LENGTH").MustInt(1000))
+ queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString("addrs=127.0.0.1:6379 db=0"))
}