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

Method trim

packages/sql/pg/src/PgConnection.ts:1516–1529  ·  view source on GitHub ↗

* A statement still being parsed cannot be closed yet: its `Parse` may not * have reached the socket. Let the cache exceed its bound temporarily, then * discard abandoned entries and close excess ready statements on access.

(protectedStatement?: Prepared)

Source from the content-addressed store, hash-verified

1514 * discard abandoned entries and close excess ready statements on access.
1515 */
1516 private trim(protectedStatement?: Prepared): void {
1517 while (this.statements.size > this.max) {
1518 let evicted: Prepared | undefined
1519 for (const prepared of this.statements.values()) {
1520 if (prepared !== protectedStatement && (prepared.ready || !prepared.parsing)) {
1521 evicted = prepared
1522 break
1523 }
1524 }
1525 if (evicted === undefined) return
1526 this.statements.delete(evicted.key)
1527 if (evicted.ready) this.close(evicted.name)
1528 }
1529 }
1530
1531 /**
1532 * Drops a statement the backend no longer holds, or whose plan went stale.

Callers 15

getMethod · 0.95
chainMethod · 0.80
finishMethod · 0.80
runMethod · 0.80
extractModuleMetadataFunction · 0.80
transformFunction · 0.80
snippetsFunction · 0.80
looksLikeFilePathFunction · 0.80
nonEmptyStringFunction · 0.80
normalizeMediaTypeFunction · 0.80
getDialectFunction · 0.80
runFunction · 0.80

Calls 2

closeMethod · 0.95
deleteMethod · 0.65

Tested by 15

execMethod · 0.64
normalizeSqlFunction · 0.64
verifySigV4Function · 0.64
textFunction · 0.64
textFunction · 0.64
parseTerrainFunction · 0.64
isEquivalentFunction · 0.64
toFramesFunction · 0.64
toRawFramesFunction · 0.64
linesWithFunction · 0.64
trimFunction · 0.64
attrMethod · 0.64