mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 22:33:33 +01:00
Use 8 as default value for git lfs concurrency (#32421)
This commit is contained in:
parent
f6273e2250
commit
b84a59b3cd
5 changed files with 9 additions and 6 deletions
|
@ -2676,7 +2676,7 @@ LEVEL = Info
|
||||||
;; Limit the number of pointers in each batch request to this number
|
;; Limit the number of pointers in each batch request to this number
|
||||||
;BATCH_SIZE = 20
|
;BATCH_SIZE = 20
|
||||||
;; Limit the number of concurrent upload/download operations within a batch
|
;; Limit the number of concurrent upload/download operations within a batch
|
||||||
;BATCH_OPERATION_CONCURRENCY = 3
|
;BATCH_OPERATION_CONCURRENCY = 8
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -136,6 +136,9 @@ func (c *HTTPClient) performOperation(ctx context.Context, objects []Pointer, dc
|
||||||
return fmt.Errorf("TransferAdapter not found: %s", result.Transfer)
|
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, groupCtx := errgroup.WithContext(ctx)
|
||||||
errGroup.SetLimit(setting.LFSClient.BatchOperationConcurrency)
|
errGroup.SetLimit(setting.LFSClient.BatchOperationConcurrency)
|
||||||
for _, object := range result.Objects {
|
for _, object := range result.Objects {
|
||||||
|
|
|
@ -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 {
|
for _, c := range cases {
|
||||||
t.Run(c.endpoint, func(t *testing.T) {
|
t.Run(c.endpoint, func(t *testing.T) {
|
||||||
client := &HTTPClient{
|
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 {
|
for _, c := range cases {
|
||||||
t.Run(c.endpoint, func(t *testing.T) {
|
t.Run(c.endpoint, func(t *testing.T) {
|
||||||
client := &HTTPClient{
|
client := &HTTPClient{
|
||||||
|
|
|
@ -67,8 +67,8 @@ func loadLFSFrom(rootCfg ConfigProvider) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if LFSClient.BatchOperationConcurrency < 1 {
|
if LFSClient.BatchOperationConcurrency < 1 {
|
||||||
// match the default git-lfs's `lfs.concurrenttransfers`
|
// 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 = 3
|
LFSClient.BatchOperationConcurrency = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(24 * time.Hour)
|
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(24 * time.Hour)
|
||||||
|
|
|
@ -115,7 +115,7 @@ BATCH_SIZE = 0
|
||||||
assert.NoError(t, loadLFSFrom(cfg))
|
assert.NoError(t, loadLFSFrom(cfg))
|
||||||
assert.EqualValues(t, 100, LFS.MaxBatchSize)
|
assert.EqualValues(t, 100, LFS.MaxBatchSize)
|
||||||
assert.EqualValues(t, 20, LFSClient.BatchSize)
|
assert.EqualValues(t, 20, LFSClient.BatchSize)
|
||||||
assert.EqualValues(t, 3, LFSClient.BatchOperationConcurrency)
|
assert.EqualValues(t, 8, LFSClient.BatchOperationConcurrency)
|
||||||
|
|
||||||
iniStr = `
|
iniStr = `
|
||||||
[lfs_client]
|
[lfs_client]
|
||||||
|
|
Loading…
Reference in a new issue