Skip to content

Commit f6c5f1f

Browse files
committed
store/bigtable: fix grpc error on close
1 parent 02926ed commit f6c5f1f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

db2/store/bigtable.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package store
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"slices"
7-
"strings"
88
"time"
99

1010
"cloud.google.com/go/bigtable"
1111
"golang.org/x/exp/maps"
12+
"google.golang.org/grpc"
1213
)
1314

1415
var ErrNotFound = fmt.Errorf("not found")
@@ -324,14 +325,11 @@ func (b BigTableStore) Clear() error {
324325
// Close shuts down the BigTableStore by closing the Bigtable client connection
325326
// It returns an error if the operation fails
326327
func (b BigTableStore) Close() error {
327-
if err := b.client.Close(); err != nil {
328+
if err := b.client.Close(); err != nil && !errors.Is(err, grpc.ErrClientConnClosing) {
328329
return fmt.Errorf("could not close client: %v", err)
329330
}
330-
if err := b.admin.Close(); err != nil {
331-
if !strings.Contains(err.Error(), "the client connection is closing") {
332-
return fmt.Errorf("could not close admin client: %v", err)
333-
}
331+
if err := b.admin.Close(); err != nil && !errors.Is(err, grpc.ErrClientConnClosing) {
332+
return fmt.Errorf("could not close admin client: %v", err)
334333
}
335-
336334
return nil
337335
}

0 commit comments

Comments
 (0)