MCPcopy
hub / github.com/sqlc-dev/sqlc / waitForPostgreSQL

Function waitForPostgreSQL

cmd/sqlc-test-setup/main.go:547–556  ·  view source on GitHub ↗

waitForPostgreSQL polls until PostgreSQL accepts connections or times out.

(timeout time.Duration)

Source from the content-addressed store, hash-verified

545
546// waitForPostgreSQL polls until PostgreSQL accepts connections or times out.
547func waitForPostgreSQL(timeout time.Duration) error {
548 deadline := time.Now().Add(timeout)
549 for time.Now().Before(deadline) {
550 if pgIsReady() {
551 return nil
552 }
553 time.Sleep(500 * time.Millisecond)
554 }
555 return fmt.Errorf("timed out after %s waiting for postgresql", timeout)
556}
557
558func startMySQL() error {
559 log.Println("--- Starting MySQL ---")

Callers 1

startPostgreSQLFunction · 0.85

Calls 2

pgIsReadyFunction · 0.85
AddMethod · 0.45

Tested by

no test coverage detected