Skip to content

Commit

Permalink
fix: repeated slice uploading on large file upload task
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Omondi committed Aug 26, 2024
1 parent 202886d commit cb329cc
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 cb329cc

Please sign in to comment.