MCPcopy Index your code
hub / github.com/rilldata/rill / awaitPostgres

Method awaitPostgres

cli/cmd/devtool/start.go:443–461  ·  view source on GitHub ↗
(ctx context.Context, preset string)

Source from the content-addressed store, hash-verified

441}
442
443func (s cloud) awaitPostgres(ctx context.Context, preset string) error {
444 logInfo.Printf("Waiting for Postgres (%s)\n", preset)
445
446 dbURL := lookupDotenv("RILL_ADMIN_DATABASE_URL")
447 for {
448 conn, err := pgx.Connect(ctx, dbURL)
449 if err == nil {
450 conn.Close(ctx)
451 logInfo.Printf("Postgres ready at %s\n", dbURL)
452 return nil
453 }
454
455 select {
456 case <-time.After(1 * time.Second):
457 case <-ctx.Done():
458 return ctx.Err()
459 }
460 }
461}
462
463func (s cloud) awaitRedis(ctx context.Context) error {
464 dbURL := lookupDotenv("RILL_ADMIN_REDIS_URL")

Callers 1

startMethod · 0.95

Calls 5

lookupDotenvFunction · 0.85
PrintfMethod · 0.80
DoneMethod · 0.80
CloseMethod · 0.65
ErrMethod · 0.65

Tested by

no test coverage detected