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

Function makeSql

apps/cloud/src/db/db.ts:53–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51};
52
53const makeSql = (): Sql =>
54 postgres(resolveConnectionString(), {
55 // max=1 is correct for Hyperdrive: one request, one connection. The
56 // earlier deadlock under ctx.transaction (outer sql.begin holding the
57 // only connection while nested writes pulled fresh ones) is fixed in
58 // @executor-js/sdk — nested writes now thread through the active FumaDB tx
59 // handle, so they reuse the same connection and never contend with the
60 // outer sql.begin.
61 max: 1,
62 idle_timeout: 0,
63 max_lifetime: 60,
64 connect_timeout: 10,
65 fetch_types: false,
66 prepare: true,
67 onnotice: () => undefined,
68 });
69
70/**
71 * Graceful drain window (seconds) handed to `postgres`'s `sql.end`. Small but

Callers 1

makePostgresResourceFunction · 0.70

Calls 1

resolveConnectionStringFunction · 0.85

Tested by

no test coverage detected