MCPcopy Create free account
hub / github.com/apecloud/myduckserver / WaitForSqlServerToStart

Function WaitForSqlServerToStart

testutil/testutil.go:171–182  ·  view source on GitHub ↗

WaitForSqlServerToStart polls the specified database to wait for it to become available, pausing between retry attempts, and returning an error if it is not able to verify that the database is available.

(database *sqlx.DB)

Source from the content-addressed store, hash-verified

169 require.NoError(t, err)
170 time.Sleep(250 * time.Millisecond)
171}
172
173// WaitForSqlServerToStart polls the specified database to wait for it to become available, pausing
174// between retry attempts, and returning an error if it is not able to verify that the database is
175// available.
176func WaitForSqlServerToStart(database *sqlx.DB) error {
177 fmt.Printf("Waiting for server to start...\n")
178 for counter := 0; counter < 50; counter++ {
179 if database.Ping() == nil {
180 return nil
181 }
182 fmt.Printf("not up yet; waiting...\n")
183 time.Sleep(500 * time.Millisecond)
184 }
185

Callers 2

startMySqlServerFunction · 0.92
StartDuckSqlServerFunction · 0.85

Calls

no outgoing calls

Tested by 1

startMySqlServerFunction · 0.74