Procházet zdrojové kódy

Commits fetch concurrency (#3837)

Thibault Meyer před 8 roky
rodič
revize
a45205b988
3 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 5 0
      conf/app.ini
  2. 1 0
      modules/setting/setting.go
  3. 1 1
      routers/repo/view.go

+ 5 - 0
conf/app.ini

@@ -31,6 +31,11 @@ PREFERRED_LICENSES = Apache License 2.0,MIT License
 DISABLE_HTTP_GIT = false
 ; Enable ability to migrate repository by local path
 ENABLE_LOCAL_PATH_MIGRATION = false
+; Concurrency is used to retrieve commits information. This variable define
+; the maximum number of tasks that can be run at the same time. Usually, the
+; value depend of how many CPUs (cores) you have. If the value is set to zero
+; or under, GOGS will automatically detect the number of CPUs your system have
+COMMITS_FETCH_CONCURRENCY = 0
 
 [repository.editor]
 ; List of file extensions that should have line wraps in the CodeMirror editor.

+ 1 - 0
modules/setting/setting.go

@@ -126,6 +126,7 @@ var (
 		PreferredLicenses        []string
 		DisableHTTPGit           bool `ini:"DISABLE_HTTP_GIT"`
 		EnableLocalPathMigration bool
+		CommitsFetchConcurrency  int
 
 		// Repository editor settings
 		Editor struct {

+ 1 - 1
routers/repo/view.go

@@ -46,7 +46,7 @@ func renderDirectory(ctx *context.Context, treeLink string) {
 	}
 	entries.Sort()
 
-	ctx.Data["Files"], err = entries.GetCommitsInfo(ctx.Repo.Commit, ctx.Repo.TreePath)
+	ctx.Data["Files"], err = entries.GetCommitsInfo(ctx.Repo.Commit, ctx.Repo.TreePath, setting.Repository.CommitsFetchConcurrency)
 	if err != nil {
 		ctx.Handle(500, "GetCommitsInfo", err)
 		return