Skip to content

Commit

Permalink
applied googleapis#8507
Browse files Browse the repository at this point in the history
  • Loading branch information
brachipa committed Aug 30, 2023
1 parent f55a4b6 commit 86ff2eb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bigquery/storage/managedwriter/managed_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ func (ms *ManagedStream) Finalize(ctx context.Context, opts ...gax.CallOption) (
func (ms *ManagedStream) appendWithRetry(pw *pendingWrite, opts ...gax.CallOption) error {
for {
ms.mu.Lock()
if ms.err != nil {
return ms.err
}
err := ms.err
ms.mu.Unlock()
if err != nil {
return err
}
conn, err := ms.pool.selectConn(pw)
if err != nil {
pw.markDone(nil, err)
Expand Down Expand Up @@ -291,10 +292,11 @@ func (ms *ManagedStream) buildRequest(data [][]byte) *storagepb.AppendRowsReques
func (ms *ManagedStream) AppendRows(ctx context.Context, data [][]byte, opts ...AppendOption) (*AppendResult, error) {
// before we do anything, ensure the writer isn't closed.
ms.mu.Lock()
if ms.err != nil {
return nil, ms.err
}
err := ms.err
ms.mu.Unlock()
if err != nil {
return nil, err
}
// Ensure we build the request and pending write with a consistent schema version.
curSchemaVersion := ms.curDescVersion
req := ms.buildRequest(data)
Expand Down

0 comments on commit 86ff2eb

Please sign in to comment.