Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllBranchCache = func() error { var ( enabledGitProjects []*models.GitProject wg = &sync.WaitGroup{} ) app.DB().Where("`enabled` = ?", true).Find(&enabledGitProjects) goroutineNum := len(enabledGitProjects) if len(enabledGitProjects) > 10 { goroutineNum = 8 } ch := make(chan *models.GitProject, goroutineNum) gitServer := plugins.GetGitServer() if server, ok := gitServer.(plugins.GitCacheServer); ok { for i := 0; i < goroutineNum; i++ { wg.Add(1) go func() { defer wg.Done() defer recovery.HandlePanic("[CRON]: all_branch_cache") for gitProject := range ch { err := server.ReCacheAllBranches(fmt.Sprintf("%d", gitProject.GitProjectId)) mlog.Debugf("[CRON]: fetch AllBranches: '%s' '%d', err: '%v'", gitProject.Name, gitProject.GitProjectId, err) } }() } for i := range enabledGitProjects { ch <- enabledGitProjects[i] } close(ch) wg.Wait() } return nil }
View Source
var AllGitProjectCache = func() error { var gitServer plugins.GitServer = plugins.GetGitServer() if cache, ok := gitServer.(plugins.GitCacheServer); ok { return cache.ReCacheAllProjects() } return nil }
Functions ¶
func CleanUploadFiles ¶
func CleanUploadFiles() error
CleanUploadFiles
1. 删除在数据库中存在,但是磁盘里面没有的文件 2. 删除本地磁盘有的,但是不存在于数据库中的文件
dangerous !
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.