Skip to content

Commit

Permalink
increase gcp upload timeout (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Feb 15, 2024
1 parent 10a2cbc commit bfc460d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/pipeline/sink/uploader/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"github.com/livekit/protocol/livekit"
)

const gcpTimeout = time.Minute

type GCPUploader struct {
conf *livekit.GCPUpload
client *storage.Client
Expand Down Expand Up @@ -73,7 +75,7 @@ func (u *GCPUploader) upload(localFilepath, storageFilepath string, _ types.Outp
var ctx context.Context
if stat.Size() <= googleapi.DefaultUploadChunkSize {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(context.Background(), time.Second*32)
ctx, cancel = context.WithTimeout(context.Background(), gcpTimeout)
defer cancel()
} else {
ctx = context.Background()
Expand All @@ -87,6 +89,7 @@ func (u *GCPUploader) upload(localFilepath, storageFilepath string, _ types.Outp
}),
storage.WithPolicy(storage.RetryAlways),
).NewWriter(ctx)
wc.ChunkRetryDeadline = gcpTimeout

if _, err = io.Copy(wc, file); err != nil {
return "", 0, wrap("GCP", err)
Expand Down

0 comments on commit bfc460d

Please sign in to comment.