Skip to content

Commit

Permalink
sax admin: don't close the channel on kUnavailable errors.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 673467645
Change-Id: I10d861ca4582f26912f18754941856cc27624804
  • Loading branch information
Sax Authors authored and copybara-github committed Sep 11, 2024
1 parent 049e123 commit baa2ccf
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions saxml/client/go/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,27 +120,12 @@ func (a *Admin) getAdminClient(ctx context.Context) (pbgrpc.AdminClient, error)
return a.client, nil
}

func (a *Admin) poison() {
a.mu.Lock()
conn := a.conn
a.conn = nil
a.client = nil
a.mu.Unlock()

if conn != nil {
conn.Close()
}
}

func (a *Admin) retry(ctx context.Context, callback func(client pbgrpc.AdminClient) error) error {
action := func() error {
client, err := a.getAdminClient(ctx)
if err == nil {
err = callback(client)
}
if errors.AdminShouldPoison(err) {
a.poison()
}
return err
}
return retrier.Do(ctx, action, errors.AdminShouldRetry)
Expand Down

0 comments on commit baa2ccf

Please sign in to comment.