Skip to content

Commit

Permalink
chore(storage): fix progress call in gRPC Writer
Browse files Browse the repository at this point in the history
  • Loading branch information
tritone committed May 2, 2023
1 parent 2bf6e14 commit 01c0197
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions storage/grpc_client.go
Expand Up @@ -1060,11 +1060,13 @@ func (c *grpcStorageClient) OpenWriter(params *openWriterParams, opts ...storage
pr.CloseWithError(err)
return
}
// At this point, the current buffer has been uploaded. Capture the
// committed offset here in case the upload was not finalized and
// another chunk is to be uploaded.
offset = off
progress(offset)
// At this point, the current buffer has been uploaded. For resumable
// uploads, capture the committed offset here in case the upload was not
// finalized and another chunk is to be uploaded.
if gw.upid != "" {
offset = off
progress(offset)
}

// When we are done reading data and the chunk has been finalized,
// we are done.
Expand Down
2 changes: 1 addition & 1 deletion storage/integration_test.go
Expand Up @@ -2251,7 +2251,7 @@ func TestIntegration_WriterContentType(t *testing.T) {
}

func TestIntegration_WriterChunksize(t *testing.T) {
ctx := skipJSONReads(skipGRPC("https://github.com/googleapis/google-cloud-go/issues/7839"), "no reads in test")
ctx := skipJSONReads(context.Background(), "no reads in test")
multiTransportTest(ctx, t, func(t *testing.T, ctx context.Context, bucket, _ string, client *Client) {
obj := client.Bucket(bucket).Object("writer-chunksize-test" + uidSpaceObjects.New())
objSize := 1<<10<<10 + 1 // 1 Mib + 1 byte
Expand Down

0 comments on commit 01c0197

Please sign in to comment.