Skip to content

Commit 211365a

Browse files
committed
fix pool item close
1 parent e8897e9 commit 211365a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Fixed connections pool leak on closing
2+
13
## v3.92.2
24
* Added `table/options.WithShardNodesInfo()` experimental option to get shard nodeId for describe table call
35

internal/pool/pool.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,15 @@ func makeAsyncCloseItemFunc[PT ItemConstraint[T], T any](
296296
p *Pool[PT, T],
297297
) func(ctx context.Context, item PT) {
298298
return func(ctx context.Context, item PT) {
299-
closeItemCtx, closeItemCancel := xcontext.WithDone(xcontext.ValueOnly(ctx), p.done)
300-
defer closeItemCancel()
301-
302-
if d := p.config.closeTimeout; d > 0 {
303-
closeItemCtx, closeItemCancel = xcontext.WithTimeout(ctx, d)
299+
go func() {
300+
closeItemCtx, closeItemCancel := xcontext.WithDone(xcontext.ValueOnly(ctx), p.done)
304301
defer closeItemCancel()
305-
}
306302

307-
go func() {
303+
if d := p.config.closeTimeout; d > 0 {
304+
closeItemCtx, closeItemCancel = xcontext.WithTimeout(ctx, d)
305+
defer closeItemCancel()
306+
}
307+
308308
_ = item.Close(closeItemCtx)
309309
}()
310310
}

0 commit comments

Comments
 (0)