mirror of
https://github.com/ollama/ollama.git
synced 2025-05-11 02:16:36 +02:00
add maximum retries when pushing (#334)
This commit is contained in:
parent
1556162c90
commit
d9cf18e28d
4 changed files with 35 additions and 21 deletions
|
@ -2,6 +2,7 @@ package server
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
|
@ -50,7 +51,7 @@ func (r AuthRedirect) URL() (string, error) {
|
|||
return fmt.Sprintf("%s?service=%s&scope=%s&ts=%d&nonce=%s", r.Realm, r.Service, r.Scope, time.Now().Unix(), nonce), nil
|
||||
}
|
||||
|
||||
func getAuthToken(redirData AuthRedirect, regOpts *RegistryOptions) (string, error) {
|
||||
func getAuthToken(ctx context.Context, redirData AuthRedirect, regOpts *RegistryOptions) (string, error) {
|
||||
url, err := redirData.URL()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -92,7 +93,7 @@ func getAuthToken(redirData AuthRedirect, regOpts *RegistryOptions) (string, err
|
|||
"Authorization": sig,
|
||||
}
|
||||
|
||||
resp, err := makeRequest("GET", url, headers, nil, regOpts)
|
||||
resp, err := makeRequest(ctx, "GET", url, headers, nil, regOpts)
|
||||
if err != nil {
|
||||
log.Printf("couldn't get token: %q", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue