2019-10-13 13:23:14 +00:00
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package setting
|
|
|
|
|
|
|
|
func newTaskService() {
|
2020-01-07 11:23:09 +00:00
|
|
|
taskSec := Cfg.Section("task")
|
|
|
|
queueTaskSec := Cfg.Section("queue.task")
|
|
|
|
switch taskSec.Key("QUEUE_TYPE").MustString(ChannelQueueType) {
|
|
|
|
case ChannelQueueType:
|
|
|
|
queueTaskSec.Key("TYPE").MustString("persistable-channel")
|
2020-10-04 17:12:26 +00:00
|
|
|
queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString(""))
|
2020-01-07 11:23:09 +00:00
|
|
|
case RedisQueueType:
|
|
|
|
queueTaskSec.Key("TYPE").MustString("redis")
|
2020-10-04 17:12:26 +00:00
|
|
|
queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString("addrs=127.0.0.1:6379 db=0"))
|
2020-01-07 11:23:09 +00:00
|
|
|
}
|
|
|
|
queueTaskSec.Key("LENGTH").MustInt(taskSec.Key("QUEUE_LENGTH").MustInt(1000))
|
2019-10-13 13:23:14 +00:00
|
|
|
}
|