(connection: PgConnection.PgConnection)
| 307 | const poolGet = borrow("traced", () => Pool.get(pool)) |
| 308 | |
| 309 | const expired = (connection: PgConnection.PgConnection): boolean => { |
| 310 | if (connectionInternals(connection).deadError() !== undefined) return true |
| 311 | if (connectionTTL === undefined) return false |
| 312 | if (!checkedOut.has(connection)) { |
| 313 | checkedOut.add(connection) |
| 314 | return false |
| 315 | } |
| 316 | const openedAt = createdAt.get(connection) |
| 317 | return openedAt !== undefined && clock.currentTimeMillisUnsafe() - openedAt >= connectionTTL |
| 318 | } |
| 319 | |
| 320 | // Runs `f` uninterruptibly in a child scope, closing it on failure or |
| 321 | // interruption so acquired resources are returned instead of left on the caller. |
no test coverage detected