Skip to content

Commit 844afd0

Browse files
authored
Merge pull request #1562 from 4el0ve4ek/fix-pool-item-close
Fix pool item close
2 parents 7374388 + 5e9d660 commit 844afd0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
* Fixed connections pool leak on closing
2+
13
## v3.92.3
24
* Fixed error with incompleted data returen from transaction.ReadQueryResult method
35
* Added option `query/WithResponsePartLimitSizeBytes(...)` for queries with query service
46

7+
58
## v3.92.2
69
* Added `table/options.WithShardNodesInfo()` experimental option to get shard nodeId for describe table call
710

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)