Skip to content

Commit dabcc95

Browse files
committed
fix timeouts for close session on closing table client
1 parent cd1b991 commit dabcc95

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

internal/table/client.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,14 @@ func (c *Client) CreateSession(ctx context.Context, opts ...table.Option) (_ tab
149149
}: // nop
150150
case <-ctx.Done():
151151
if s != nil {
152-
_ = s.Close(xcontext.WithoutDeadline(ctx))
152+
var cancel context.CancelFunc
153+
ctx, cancel = context.WithTimeout(
154+
xcontext.WithoutDeadline(ctx),
155+
c.config.DeleteTimeout(),
156+
)
157+
defer cancel()
158+
159+
_ = s.Close(ctx)
153160
}
154161
}
155162
})
@@ -328,7 +335,14 @@ func (c *Client) createSession(ctx context.Context) (s Session, err error) {
328335
}: // nop
329336
case <-ctx.Done():
330337
if s != nil {
331-
_ = s.Close(xcontext.WithoutDeadline(ctx))
338+
var cancel context.CancelFunc
339+
ctx, cancel = context.WithTimeout(
340+
xcontext.WithoutDeadline(ctx),
341+
c.config.DeleteTimeout(),
342+
)
343+
defer cancel()
344+
345+
_ = s.Close(ctx)
332346
}
333347
}
334348
})

0 commit comments

Comments
 (0)