Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
const maxChunkSize = 8 * 1024 * 1024 // 8 MB chunk size
const maxRetryCount = 3
const initialRetryDelay = time.Second
const delayMultiplier = 2

type apiClient struct {
clientConfig *ClientConfig
Expand Down Expand Up @@ -650,7 +649,7 @@ func (ac *apiClient) upload(ctx context.Context, r io.Reader, uploadURL string,
select {
case <-ctx.Done():
return nil, fmt.Errorf("upload aborted while waiting to retry (attempt %d, offset %d): %w", attempt+1, offset, ctx.Err())
case <-time.After(initialRetryDelay * time.Duration(delayMultiplier^attempt)):
case <-time.After(initialRetryDelay * time.Duration(1<<attempt)):
// Sleep completed, continue to the next attempt.
}
}
Expand Down