waitForRunningDatabase is a blocking function waiting for the database to be running.
(ctx context.Context, client *scalingo.Client, appID string)
| 60 | |
| 61 | // waitForRunningDatabase is a blocking function waiting for the database to be running. |
| 62 | func waitForRunningDatabase(ctx context.Context, client *scalingo.Client, appID string) error { |
| 63 | for range time.Tick(10 * time.Second) { |
| 64 | db, err := client.Preview().DatabaseShow(ctx, appID) |
| 65 | if errors.Is(err, scalingo.ErrDatabaseNotFound) { |
| 66 | continue |
| 67 | } else if err != nil { |
| 68 | return errors.Wrapf(ctx, err, "get database %s status", appID) |
| 69 | } |
| 70 | if db.Database.Status == scalingo.DatabaseStatusRunning { |
| 71 | break |
| 72 | } |
| 73 | } |
| 74 | return nil |
| 75 | } |
no outgoing calls
no test coverage detected