Skip to content

Commit 41b4ef8

Browse files
authored
Use 8 as default value for git lfs concurrency (#32421)
1 parent 24b83ff commit 41b4ef8

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

Diff for: custom/conf/app.example.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -2650,7 +2650,7 @@ LEVEL = Info
26502650
;; Limit the number of pointers in each batch request to this number
26512651
;BATCH_SIZE = 20
26522652
;; Limit the number of concurrent upload/download operations within a batch
2653-
;BATCH_OPERATION_CONCURRENCY = 3
2653+
;BATCH_OPERATION_CONCURRENCY = 8
26542654

26552655
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26562656
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Diff for: modules/lfs/http_client.go

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ func (c *HTTPClient) performOperation(ctx context.Context, objects []Pointer, dc
136136
return fmt.Errorf("TransferAdapter not found: %s", result.Transfer)
137137
}
138138

139+
if setting.LFSClient.BatchOperationConcurrency <= 0 {
140+
panic("BatchOperationConcurrency must be greater than 0, forgot to init?")
141+
}
139142
errGroup, groupCtx := errgroup.WithContext(ctx)
140143
errGroup.SetLimit(setting.LFSClient.BatchOperationConcurrency)
141144
for _, object := range result.Objects {

Diff for: modules/lfs/http_client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func TestHTTPClientDownload(t *testing.T) {
237237
},
238238
}
239239

240-
defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 3)()
240+
defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 8)()
241241
for _, c := range cases {
242242
t.Run(c.endpoint, func(t *testing.T) {
243243
client := &HTTPClient{
@@ -337,7 +337,7 @@ func TestHTTPClientUpload(t *testing.T) {
337337
},
338338
}
339339

340-
defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 3)()
340+
defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 8)()
341341
for _, c := range cases {
342342
t.Run(c.endpoint, func(t *testing.T) {
343343
client := &HTTPClient{

Diff for: modules/setting/lfs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ func loadLFSFrom(rootCfg ConfigProvider) error {
6868
}
6969

7070
if LFSClient.BatchOperationConcurrency < 1 {
71-
// match the default git-lfs's `lfs.concurrenttransfers`
72-
LFSClient.BatchOperationConcurrency = 3
71+
// 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
72+
LFSClient.BatchOperationConcurrency = 8
7373
}
7474

7575
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(24 * time.Hour)

Diff for: modules/setting/lfs_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ BATCH_SIZE = 0
114114
assert.NoError(t, loadLFSFrom(cfg))
115115
assert.EqualValues(t, 100, LFS.MaxBatchSize)
116116
assert.EqualValues(t, 20, LFSClient.BatchSize)
117-
assert.EqualValues(t, 3, LFSClient.BatchOperationConcurrency)
117+
assert.EqualValues(t, 8, LFSClient.BatchOperationConcurrency)
118118

119119
iniStr = `
120120
[lfs_client]

0 commit comments

Comments
 (0)