MCPcopy Create free account
hub / github.com/TanStack/db / waitForPostgres

Function waitForPostgres

packages/db-collection-e2e/support/global-setup.ts:75–93  ·  view source on GitHub ↗

* Wait for Postgres to be ready

(client: Client)

Source from the content-addressed store, hash-verified

73 * Wait for Postgres to be ready
74 */
75async function waitForPostgres(client: Client): Promise<void> {
76 return new Promise<void>((resolve, reject) => {
77 const timeout = setTimeout(() => {
78 reject(new Error('Timed out waiting for Postgres'))
79 }, 10000)
80
81 const check = async (): Promise<void> => {
82 try {
83 await client.connect()
84 clearTimeout(timeout)
85 return resolve()
86 } catch {
87 setTimeout(() => void check(), 100)
88 }
89 }
90
91 void check()
92 })
93}
94
95/**
96 * Global setup for e2e test suite

Callers 1

global-setup.tsFile · 0.85

Calls 1

checkFunction · 0.70

Tested by

no test coverage detected