Skip to content

Commit

Permalink
Only write to the rawBucket if the value exists.
Browse files Browse the repository at this point in the history
Signed-off-by: Caleb Brown <[email protected]>
  • Loading branch information
calebbrown committed Nov 11, 2022
1 parent 5ec4705 commit f8ba409
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cron/internal/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,16 @@ func main() {
panic(fmt.Errorf("error writing to BlobStore: %w", err))
}

// Raw data.
*metadata.ShardLoc = rawBucket + "/" + data.GetBlobFilename("", t)
metadataJSON, err = protojson.Marshal(&metadata)
if err != nil {
panic(fmt.Errorf("error during protojson.Marshal raw: %w", err))
}
err = data.WriteToBlobStore(ctx, rawBucket, data.GetShardMetadataFilename(t), metadataJSON)
if err != nil {
panic(fmt.Errorf("error writing to BlobStore raw: %w", err))
if rawBucket != "" {
// Raw data.
*metadata.ShardLoc = rawBucket + "/" + data.GetBlobFilename("", t)
metadataJSON, err = protojson.Marshal(&metadata)
if err != nil {
panic(fmt.Errorf("error during protojson.Marshal raw: %w", err))
}
err = data.WriteToBlobStore(ctx, rawBucket, data.GetShardMetadataFilename(t), metadataJSON)
if err != nil {
panic(fmt.Errorf("error writing to BlobStore raw: %w", err))
}
}
}

0 comments on commit f8ba409

Please sign in to comment.