diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 2e5ab5bbab..ee8ad66668 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -2676,7 +2676,7 @@ LEVEL = Info ;; Limit the number of pointers in each batch request to this number ;BATCH_SIZE = 20 ;; Limit the number of concurrent upload/download operations within a batch -;BATCH_OPERATION_CONCURRENCY = 3 +;BATCH_OPERATION_CONCURRENCY = 8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/modules/lfs/http_client.go b/modules/lfs/http_client.go index 411c4248c4..3060e25754 100644 --- a/modules/lfs/http_client.go +++ b/modules/lfs/http_client.go @@ -136,6 +136,9 @@ func (c *HTTPClient) performOperation(ctx context.Context, objects []Pointer, dc return fmt.Errorf("TransferAdapter not found: %s", result.Transfer) } + if setting.LFSClient.BatchOperationConcurrency <= 0 { + panic("BatchOperationConcurrency must be greater than 0, forgot to init?") + } errGroup, groupCtx := errgroup.WithContext(ctx) errGroup.SetLimit(setting.LFSClient.BatchOperationConcurrency) for _, object := range result.Objects { diff --git a/modules/lfs/http_client_test.go b/modules/lfs/http_client_test.go index aecb4692cd..d78224a806 100644 --- a/modules/lfs/http_client_test.go +++ b/modules/lfs/http_client_test.go @@ -238,7 +238,7 @@ func TestHTTPClientDownload(t *testing.T) { }, } - defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 3)() + defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 8)() for _, c := range cases { t.Run(c.endpoint, func(t *testing.T) { client := &HTTPClient{ @@ -338,7 +338,7 @@ func TestHTTPClientUpload(t *testing.T) { }, } - defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 3)() + defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 8)() for _, c := range cases { t.Run(c.endpoint, func(t *testing.T) { client := &HTTPClient{ diff --git a/modules/setting/lfs.go b/modules/setting/lfs.go index c3a37513ea..f55b0cdae9 100644 --- a/modules/setting/lfs.go +++ b/modules/setting/lfs.go @@ -67,8 +67,8 @@ func loadLFSFrom(rootCfg ConfigProvider) error { } if LFSClient.BatchOperationConcurrency < 1 { - // match the default git-lfs's `lfs.concurrenttransfers` - LFSClient.BatchOperationConcurrency = 3 + // match the default git-lfs's `lfs.concurrenttransfers` https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-config.adoc#upload-and-download-transfer-settings + LFSClient.BatchOperationConcurrency = 8 } LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(24 * time.Hour) diff --git a/modules/setting/lfs_test.go b/modules/setting/lfs_test.go index e546690b33..2b204282a8 100644 --- a/modules/setting/lfs_test.go +++ b/modules/setting/lfs_test.go @@ -115,7 +115,7 @@ BATCH_SIZE = 0 assert.NoError(t, loadLFSFrom(cfg)) assert.EqualValues(t, 100, LFS.MaxBatchSize) assert.EqualValues(t, 20, LFSClient.BatchSize) - assert.EqualValues(t, 3, LFSClient.BatchOperationConcurrency) + assert.EqualValues(t, 8, LFSClient.BatchOperationConcurrency) iniStr = ` [lfs_client]