From 30c14f63a63549a708eed51c0d19e8355e69d99d Mon Sep 17 00:00:00 2001 From: Seth Hollyman Date: Mon, 28 Mar 2022 21:40:33 +0000 Subject: [PATCH] fix(bigquery): improve retry for table create Wraps table creation in the standard retryer. Fixes: https://github.com/googleapis/google-cloud-go/issues/5805 --- bigquery/table.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bigquery/table.go b/bigquery/table.go index 764e6b27a7c4..52dbd14ad22d 100644 --- a/bigquery/table.go +++ b/bigquery/table.go @@ -537,10 +537,13 @@ func (t *Table) Create(ctx context.Context, tm *TableMetadata) (err error) { DatasetId: t.DatasetID, TableId: t.TableID, } + req := t.c.bqs.Tables.Insert(t.ProjectID, t.DatasetID, table).Context(ctx) setClientHeader(req.Header()) - _, err = req.Do() - return err + return runWithRetry(ctx, func() (err error) { + _, err = req.Do() + return err + }) } func (tm *TableMetadata) toBQ() (*bq.Table, error) {