Skip to content

Commit

Permalink
Merge pull request #321 from microsoftgraph/andrueastman/fixRepeatedS…
Browse files Browse the repository at this point in the history
…lices

fix: repeated slice uploading on large file upload task
  • Loading branch information
andrueastman authored Aug 26, 2024
2 parents 202886d + cb329cc commit 5aa1169
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion authentication/azure_identity_access_token_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewAzureIdentityAccessTokenProviderWithScopesAndValidHostsAndObservabilityO
if err != nil {
return nil, err
}
if len(scopes) == 0 {
if len(validHosts) == 0 {
base.GetAllowedHostsValidator().SetAllowedHosts([]string{"graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"})
}
result := &AzureIdentityAccessTokenProvider{
Expand Down
7 changes: 5 additions & 2 deletions fileuploader/large_file_upload_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package fileuploader
import (
"context"
"errors"
abstractions "github.com/microsoft/kiota-abstractions-go"
"github.com/microsoft/kiota-abstractions-go/serialization"
"io"
"os"
"strconv"
"strings"
"time"

abstractions "github.com/microsoft/kiota-abstractions-go"
"github.com/microsoft/kiota-abstractions-go/serialization"
)

type LargeFileUploadTask[T serialization.Parsable] interface {
Expand Down Expand Up @@ -140,6 +141,8 @@ func (l *largeFileUploadTask[T]) uploadWithRetry(slice uploadSlice[T], maxRetry
}
// backoff before retrying
time.Sleep(time.Duration(retry) * time.Second)
} else {
return parseable, location, err // return the result as the upload was successful
}
retry++
}
Expand Down

0 comments on commit 5aa1169

Please sign in to comment.