summaryrefslogtreecommitdiffstats
path: root/modules/setting/task.go
blob: d9329dbb7608e2e28bfa05f0f247072640f64838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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() {
	taskSec := Cfg.Section("task")
	queueTaskSec := Cfg.Section("queue.task")
	switch taskSec.Key("QUEUE_TYPE").MustString(ChannelQueueType) {
	case ChannelQueueType:
		queueTaskSec.Key("TYPE").MustString("persistable-channel")
		queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString(""))
	case RedisQueueType:
		queueTaskSec.Key("TYPE").MustString("redis")
		queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString("addrs=127.0.0.1:6379 db=0"))
	}
	queueTaskSec.Key("LENGTH").MustInt(taskSec.Key("QUEUE_LENGTH").MustInt(1000))
}