Adding a 2 second timeout after the message occurs to make sure DB is fully started - can't wait for both messages.

This commit is contained in:
mike12345567 2024-01-26 14:22:25 +00:00
parent d4fd775c37
commit 870ca2266e
4 changed files with 8 additions and 4 deletions

View File

@ -147,7 +147,8 @@
"tsconfig-paths": "4.0.0", "tsconfig-paths": "4.0.0",
"typescript": "5.2.2", "typescript": "5.2.2",
"update-dotenv": "1.1.1", "update-dotenv": "1.1.1",
"yargs": "13.2.4" "yargs": "13.2.4",
"node-duration": "1.0.4"
}, },
"optionalDependencies": { "optionalDependencies": {
"oracledb": "5.3.0" "oracledb": "5.3.0"

View File

@ -2,7 +2,7 @@ version: "3.8"
services: services:
db: db:
container_name: postgres container_name: postgres
image: postgres:15-bullseye image: postgres:latest
restart: unless-stopped restart: unless-stopped
environment: environment:
POSTGRES_USER: root POSTGRES_USER: root

View File

@ -1,5 +1,6 @@
import { Datasource, SourceName } from "@budibase/types" import { Datasource, SourceName } from "@budibase/types"
import { GenericContainer, Wait, StartedTestContainer } from "testcontainers" import { GenericContainer, Wait, StartedTestContainer } from "testcontainers"
import { Duration, TemporalUnit } from "node-duration"
import env from "../../../environment" import env from "../../../environment"
let container: StartedTestContainer | undefined let container: StartedTestContainer | undefined
@ -15,7 +16,9 @@ export async function getDsConfig(): Promise<Datasource> {
.withExposedPorts(5432) .withExposedPorts(5432)
.withEnv("POSTGRES_PASSWORD", "password") .withEnv("POSTGRES_PASSWORD", "password")
.withWaitStrategy( .withWaitStrategy(
Wait.forLogMessage("database system is ready to accept connections") Wait.forLogMessage(
"PostgreSQL init process complete; ready for start up."
).withStartupTimeout(new Duration(2, TemporalUnit.SECONDS))
) )
.start() .start()
} }

View File

@ -15568,7 +15568,7 @@ node-addon-api@^6.1.0:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-6.1.0.tgz#ac8470034e58e67d0c6f1204a18ae6995d9c0d76" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-6.1.0.tgz#ac8470034e58e67d0c6f1204a18ae6995d9c0d76"
integrity sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA== integrity sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==
node-duration@^1.0.4: node-duration@1.0.4, node-duration@^1.0.4:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/node-duration/-/node-duration-1.0.4.tgz#3e94ecc0e473691c89c4560074503362071cecac" resolved "https://registry.yarnpkg.com/node-duration/-/node-duration-1.0.4.tgz#3e94ecc0e473691c89c4560074503362071cecac"
integrity sha512-eUXYNSY7DL53vqfTosggWkvyIW3bhAcqBDIlolgNYlZhianXTrCL50rlUJWD1eRqkIxMppXTfiFbp+9SjpPrgA== integrity sha512-eUXYNSY7DL53vqfTosggWkvyIW3bhAcqBDIlolgNYlZhianXTrCL50rlUJWD1eRqkIxMppXTfiFbp+9SjpPrgA==