MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / closeOldIdleConnections

Method closeOldIdleConnections

IceFireDB-SQLite/pkg/mysql/client/pool.go:296–312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

294}
295
296func (pool *Pool) closeOldIdleConnections() {
297 var toPing []Connection
298
299 ticker := time.NewTicker(5 * time.Second)
300
301 for range ticker.C {
302 toPing = pool.getOldIdleConnections(toPing[:0])
303 if len(toPing) == 0 {
304 continue
305 }
306 pool.recheckConnections(toPing)
307
308 if !pool.spawnConnectionsIfNeeded() {
309 pool.closeIdleConnectionsIfCan()
310 }
311 }
312}
313
314func (pool *Pool) getOldIdleConnections(dst []Connection) []Connection {
315 dst = dst[:0]

Callers 1

NewPoolFunction · 0.95

Calls 4

getOldIdleConnectionsMethod · 0.95
recheckConnectionsMethod · 0.95

Tested by

no test coverage detected