()
| 152 | } |
| 153 | |
| 154 | async checkIfInstanceIsRunningReportStatus(): Promise<void> { |
| 155 | this.logger.startSpinner( |
| 156 | 'Running health check on Dgraph' |
| 157 | ) |
| 158 | // eslint-disable-next-line no-warning-comments |
| 159 | // TODO: smaller sleep time and exponential backoff for ~5 tries |
| 160 | await sleep(10000) |
| 161 | try { |
| 162 | const storageEngine = await this.getStorageEngine() |
| 163 | const running = await storageEngine.healthCheck(false) |
| 164 | if (running) { |
| 165 | this.logger.successSpinner('Dgraph health check passed') |
| 166 | } else { |
| 167 | throw new Error('Dgraph was unable to start: Dgraph not running') |
| 168 | } |
| 169 | } catch (error: any) { |
| 170 | this.logger.debug(error) |
| 171 | throw new Error('Dgraph was unable to start: Failed running health check') |
| 172 | } |
| 173 | this.logger.success( |
| 174 | `Access your dgraph instance at ${chalk.underline.green( |
| 175 | this.getHost((await this.getStorageEngine() as DgraphEngine).connectionConfig) |
| 176 | )}` |
| 177 | ) |
| 178 | this.logger.info( |
| 179 | `For more information on dgraph, see the dgraph docs at: ${chalk.underline.green( |
| 180 | 'https://dgraph.io/docs/graphql/' |
| 181 | )}` |
| 182 | ) |
| 183 | } |
| 184 | } |
no test coverage detected