* use buffersize to reduce database connection when iterate * fix typo * add default value on app.ini commenttags/v1.3.0-rc1
PATH = data/gitea.db | PATH = data/gitea.db | ||||
; For "sqlite3" only. Query timeout | ; For "sqlite3" only. Query timeout | ||||
SQLITE_TIMEOUT = 500 | SQLITE_TIMEOUT = 500 | ||||
; For iterate buffer, default is 50 | |||||
ITERATE_BUFFER_SIZE = 50 | |||||
[indexer] | [indexer] | ||||
ISSUE_INDEXER_PATH = indexers/issues.bleve | ISSUE_INDEXER_PATH = indexers/issues.bleve |
} | } | ||||
) | ) | ||||
return x.Where("id > 0").Iterate(new(Repository), | |||||
return x.Where("id > 0").BufferSize(setting.IterateBufferSize).Iterate(new(Repository), | |||||
func(idx int, bean interface{}) error { | func(idx int, bean interface{}) error { | ||||
repo := bean.(*Repository) | repo := bean.(*Repository) | ||||
user := new(User) | user := new(User) |
} | } | ||||
) | ) | ||||
return x.Where("id > 0").Iterate(new(Repository), | |||||
return x.Where("id > 0").BufferSize(setting.IterateBufferSize).Iterate(new(Repository), | |||||
func(idx int, bean interface{}) error { | func(idx int, bean interface{}) error { | ||||
repo := bean.(*Repository) | repo := bean.(*Repository) | ||||
user := new(User) | user := new(User) |
hookTpl = fmt.Sprintf("#!/usr/bin/env %s\ndata=$(cat)\nexitcodes=\"\"\nhookname=$(basename $0)\nGIT_DIR=${GIT_DIR:-$(dirname $0)}\n\nfor hook in ${GIT_DIR}/hooks/${hookname}.d/*; do\ntest -x \"${hook}\" || continue\necho \"${data}\" | \"${hook}\"\nexitcodes=\"${exitcodes} $?\"\ndone\n\nfor i in ${exitcodes}; do\n[ ${i} -eq 0 ] || exit ${i}\ndone\n", setting.ScriptType) | hookTpl = fmt.Sprintf("#!/usr/bin/env %s\ndata=$(cat)\nexitcodes=\"\"\nhookname=$(basename $0)\nGIT_DIR=${GIT_DIR:-$(dirname $0)}\n\nfor hook in ${GIT_DIR}/hooks/${hookname}.d/*; do\ntest -x \"${hook}\" || continue\necho \"${data}\" | \"${hook}\"\nexitcodes=\"${exitcodes} $?\"\ndone\n\nfor i in ${exitcodes}; do\n[ ${i} -eq 0 ] || exit ${i}\ndone\n", setting.ScriptType) | ||||
) | ) | ||||
return x.Where("id > 0").Iterate(new(Repository), | |||||
return x.Where("id > 0").BufferSize(setting.IterateBufferSize).Iterate(new(Repository), | |||||
func(idx int, bean interface{}) error { | func(idx int, bean interface{}) error { | ||||
repo := bean.(*Repository) | repo := bean.(*Repository) | ||||
user := new(User) | user := new(User) |
log.Trace("Doing: GitFsck") | log.Trace("Doing: GitFsck") | ||||
if err := x. | if err := x. | ||||
Where("id>0"). | |||||
Where("id>0").BufferSize(setting.IterateBufferSize). | |||||
Iterate(new(Repository), | Iterate(new(Repository), | ||||
func(idx int, bean interface{}) error { | func(idx int, bean interface{}) error { | ||||
repo := bean.(*Repository) | repo := bean.(*Repository) | ||||
func GitGcRepos() error { | func GitGcRepos() error { | ||||
args := append([]string{"gc"}, setting.Git.GCArgs...) | args := append([]string{"gc"}, setting.Git.GCArgs...) | ||||
return x. | return x. | ||||
Where("id > 0"). | |||||
Where("id > 0").BufferSize(setting.IterateBufferSize). | |||||
Iterate(new(Repository), | Iterate(new(Repository), | ||||
func(idx int, bean interface{}) error { | func(idx int, bean interface{}) error { | ||||
repo := bean.(*Repository) | repo := bean.(*Repository) |
} | } | ||||
// Delete all local copies of repository wiki that user owns. | // Delete all local copies of repository wiki that user owns. | ||||
if err = x. | |||||
if err = x.BufferSize(setting.IterateBufferSize). | |||||
Where("owner_id=?", u.ID). | Where("owner_id=?", u.ID). | ||||
Iterate(new(Repository), func(idx int, bean interface{}) error { | Iterate(new(Repository), func(idx int, bean interface{}) error { | ||||
repo := bean.(*Repository) | repo := bean.(*Repository) |
ShowFooterTemplateLoadTime bool | ShowFooterTemplateLoadTime bool | ||||
// Global setting objects | // Global setting objects | ||||
Cfg *ini.File | |||||
CustomPath string // Custom directory path | |||||
CustomConf string | |||||
CustomPID string | |||||
ProdMode bool | |||||
RunUser string | |||||
IsWindows bool | |||||
HasRobotsTxt bool | |||||
InternalToken string // internal access token | |||||
Cfg *ini.File | |||||
CustomPath string // Custom directory path | |||||
CustomConf string | |||||
CustomPID string | |||||
ProdMode bool | |||||
RunUser string | |||||
IsWindows bool | |||||
HasRobotsTxt bool | |||||
InternalToken string // internal access token | |||||
IterateBufferSize int | |||||
) | ) | ||||
// DateLang transforms standard language locale name to corresponding value in datetime plugin. | // DateLang transforms standard language locale name to corresponding value in datetime plugin. | ||||
log.Fatal(4, "Error saving generated JWT Secret to custom config: %v", err) | log.Fatal(4, "Error saving generated JWT Secret to custom config: %v", err) | ||||
} | } | ||||
} | } | ||||
IterateBufferSize = Cfg.Section("database").Key("ITERATE_BUFFER_SIZE").MustInt(50) | |||||
sec = Cfg.Section("attachment") | sec = Cfg.Section("attachment") | ||||
AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments")) | AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments")) |