Revert "adjust download and upload concurrency based on available bandwidth" (#2995)

This commit is contained in:
Jeffrey Morgan 2024-03-07 18:10:16 -08:00 committed by GitHub
parent 2ada81e068
commit fc06205971
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 106 deletions

View file

@ -18,6 +18,7 @@ import (
"github.com/jmorganca/ollama/api"
"github.com/jmorganca/ollama/format"
"golang.org/x/sync/errgroup"
)
var blobUploadManager sync.Map
@ -136,17 +137,14 @@ func (b *blobUpload) Run(ctx context.Context, opts *registryOptions) {
}
defer b.file.Close()
var limit int64 = 2
g, inner := NewLimitGroup(ctx, numUploadParts, limit)
go watchDelta(inner, g, &b.Completed, limit)
g, inner := errgroup.WithContext(ctx)
g.SetLimit(numUploadParts)
for i := range b.Parts {
part := &b.Parts[i]
select {
case <-inner.Done():
break
case requestURL := <-b.nextURL:
g.Go(inner, func() error {
g.Go(func() error {
var err error
for try := 0; try < maxRetries; try++ {
err = b.uploadPart(inner, http.MethodPatch, requestURL, part, opts)