Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,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

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down
3 changes: 3 additions & 0 deletions modules/lfs/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions modules/lfs/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,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{
Expand Down Expand Up @@ -337,7 +337,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{
Expand Down
4 changes: 2 additions & 2 deletions modules/setting/lfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,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)
Expand Down
2 changes: 1 addition & 1 deletion modules/setting/lfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,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]
Expand Down
Loading