Skip to content

Commit

Permalink
storage/blob/s3: Add missing didSync check
Browse files Browse the repository at this point in the history
  • Loading branch information
foxcpp committed Aug 9, 2021
1 parent 61e6e73 commit ff584bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/storage/blob/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ type s3blob struct {
func (b *s3blob) Sync() error {
// We do this in Sync instead of Close because
// backend may not actually check the error of Close.

// The problematic restriction is that Sync can now be called
// only once.
if b.didSync {
panic("storage.blob.s3: Sync called twice for a blob object")
}

b.pw.Close()
b.didSync = true
return <-b.errCh
}

Expand Down

0 comments on commit ff584bb

Please sign in to comment.