code.gitea.io/gitea@v1.19.3/modules/setting/task.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package setting
     5  
     6  // DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
     7  // if these are removed, the warning will not be shown
     8  // - will need to set default for [queue.task] LENGTH to 1000 though
     9  func loadTaskFrom(rootCfg ConfigProvider) {
    10  	taskSec := rootCfg.Section("task")
    11  	queueTaskSec := rootCfg.Section("queue.task")
    12  
    13  	deprecatedSetting(rootCfg, "task", "QUEUE_TYPE", "queue.task", "TYPE", "v1.19.0")
    14  	deprecatedSetting(rootCfg, "task", "QUEUE_CONN_STR", "queue.task", "CONN_STR", "v1.19.0")
    15  	deprecatedSetting(rootCfg, "task", "QUEUE_LENGTH", "queue.task", "LENGTH", "v1.19.0")
    16  
    17  	switch taskSec.Key("QUEUE_TYPE").MustString("channel") {
    18  	case "channel":
    19  		queueTaskSec.Key("TYPE").MustString("persistable-channel")
    20  		queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString(""))
    21  	case "redis":
    22  		queueTaskSec.Key("TYPE").MustString("redis")
    23  		queueTaskSec.Key("CONN_STR").MustString(taskSec.Key("QUEUE_CONN_STR").MustString("addrs=127.0.0.1:6379 db=0"))
    24  	}
    25  	queueTaskSec.Key("LENGTH").MustInt(taskSec.Key("QUEUE_LENGTH").MustInt(1000))
    26  }