github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/setting/task.go (about)

     1  // Copyright 2023 The GitBundle Inc. All rights reserved.
     2  // Copyright 2017 The Gitea Authors. All rights reserved.
     3  // Use of this source code is governed by a MIT-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package setting
     7  
     8  // FIXME: DEPRECATED to be removed in v1.18.0
     9  // - will need to set default for [queue.task] LENGTH to 1000 though
    10  func newTaskService() {
    11  	taskSec := Cfg.Section("task")
    12  	queueTaskSec := Cfg.Section("queue.task")
    13  
    14  	deprecatedSetting("task", "QUEUE_TYPE", "queue.task", "TYPE")
    15  	deprecatedSetting("task", "QUEUE_CONN_STR", "queue.task", "CONN_STR")
    16  	deprecatedSetting("task", "QUEUE_LENGTH", "queue.task", "LENGTH")
    17  
    18  	switch taskSec.Key("QUEUE_TYPE").MustString("channel") {
    19  	case "channel":
    20  		queueTaskSec.Key("TYPE").MustString("persistable-channel")
    21  		queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString(""))
    22  	case "redis":
    23  		queueTaskSec.Key("TYPE").MustString("redis")
    24  		queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString("addrs=127.0.0.1:6379 db=0"))
    25  	}
    26  	queueTaskSec.Key("LENGTH").MustInt(taskSec.Key("QUEUE_LENGTH").MustInt(1000))
    27  }