summaryrefslogtreecommitdiffstats
path: root/modules/lfs
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-11-05 14:10:57 +0100
committerOtto Richter <git@otto.splvs.net>2024-12-06 00:17:57 +0100
commitb84a59b3cd595937aea1fe54a6f7e758e9b42e8e (patch)
tree7b346a4d49d48eb57190fc25eb32856fc0f91a32 /modules/lfs
parentMake LFS http_client parallel within a batch. (#32369) (diff)
downloadforgejo-b84a59b3cd595937aea1fe54a6f7e758e9b42e8e.tar.xz
forgejo-b84a59b3cd595937aea1fe54a6f7e758e9b42e8e.zip
Use 8 as default value for git lfs concurrency (#32421)
Diffstat (limited to 'modules/lfs')
-rw-r--r--modules/lfs/http_client.go3
-rw-r--r--modules/lfs/http_client_test.go4
2 files changed, 5 insertions, 2 deletions
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{