MCPcopy Create free account
hub / github.com/Effect-TS/effect / expired

Function expired

packages/sql/pg/src/PgPool.ts:309–318  ·  view source on GitHub ↗
(connection: PgConnection.PgConnection)

Source from the content-addressed store, hash-verified

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.

Callers 2

PgPool.tsFile · 0.70
useFunction · 0.70

Calls 5

connectionInternalsFunction · 0.90
hasMethod · 0.65
addMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected