MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / makeServer

Function makeServer

apps/cloud/scripts/dev-db.ts:122–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120// src/db/dev-db-socket-concurrency.node.test.ts is the regression test for
121// all of the above.
122const makeServer = () =>
123 new PGLiteSocketServer({
124 db,
125 port: PORT,
126 host: "127.0.0.1",
127 maxConnections: Number(process.env.DEV_DB_MAX_CONNECTIONS ?? 1000),
128 // Backstop for pipeline affinity: a client that stalls mid-pipeline (Parse
129 // sent, no Sync) with its socket still OPEN would hold the queue's handler
130 // affinity forever and starve every other connection, since affinity only
131 // releases on detach and detach needs close/error/idle-timeout. In ms; the
132 // timer resets on every data event. The patch scopes the reap to connections
133 // actually HOLDING affinity (open pipeline or transaction): an idle-at-rest
134 // connection is the normal state of a healthy postgres.js pool held by a
135 // long-lived scope (SSE), and reaping those raced live queries into
136 // sporadic `write CONNECTION_ENDED` 500s.
137 idleTimeout: Number(process.env.DEV_DB_IDLE_TIMEOUT_MS ?? 30_000),
138 });
139
140let server = makeServer();
141await server.start();

Callers 2

dev-db.tsFile · 0.70
restartFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected