Skip to content

Commit

Permalink
store/bigtable: fix grpc error on close
Browse files Browse the repository at this point in the history
  • Loading branch information
Tangui-Bitfly committed Oct 30, 2024
1 parent 02926ed commit f6c5f1f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions db2/store/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package store

import (
"context"
"errors"
"fmt"
"slices"
"strings"
"time"

"cloud.google.com/go/bigtable"
"golang.org/x/exp/maps"
"google.golang.org/grpc"
)

var ErrNotFound = fmt.Errorf("not found")
Expand Down Expand Up @@ -324,14 +325,11 @@ func (b BigTableStore) Clear() error {
// Close shuts down the BigTableStore by closing the Bigtable client connection
// It returns an error if the operation fails
func (b BigTableStore) Close() error {
if err := b.client.Close(); err != nil {
if err := b.client.Close(); err != nil && !errors.Is(err, grpc.ErrClientConnClosing) {

Check failure on line 328 in db2/store/bigtable.go

View workflow job for this annotation

GitHub Actions / Run CI (ubuntu-latest, 1.21.x)

grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead. (SA1019)
return fmt.Errorf("could not close client: %v", err)
}
if err := b.admin.Close(); err != nil {
if !strings.Contains(err.Error(), "the client connection is closing") {
return fmt.Errorf("could not close admin client: %v", err)
}
if err := b.admin.Close(); err != nil && !errors.Is(err, grpc.ErrClientConnClosing) {

Check failure on line 331 in db2/store/bigtable.go

View workflow job for this annotation

GitHub Actions / Run CI (ubuntu-latest, 1.21.x)

grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead. (SA1019)
return fmt.Errorf("could not close admin client: %v", err)
}

return nil
}

0 comments on commit f6c5f1f

Please sign in to comment.