mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-01 12:44:43 +00:00
ping drizzle connection
This commit is contained in:
parent
349fa32ede
commit
165fc3fbf1
@ -1,4 +1,3 @@
|
|||||||
import { sql } from 'drizzle-orm'
|
|
||||||
import { drizzle, MySql2Database } from 'drizzle-orm/mysql2'
|
import { drizzle, MySql2Database } from 'drizzle-orm/mysql2'
|
||||||
import Redis from 'ioredis'
|
import Redis from 'ioredis'
|
||||||
import { getLogger } from 'log4js'
|
import { getLogger } from 'log4js'
|
||||||
@ -92,6 +91,7 @@ export class AppDatabase {
|
|||||||
database: CONFIG.DB_DATABASE,
|
database: CONFIG.DB_DATABASE,
|
||||||
port: CONFIG.DB_PORT,
|
port: CONFIG.DB_PORT,
|
||||||
})
|
})
|
||||||
|
await this.drizzleConnection.ping()
|
||||||
this.drizzleDataSource = drizzle({ client: this.drizzleConnection })
|
this.drizzleDataSource = drizzle({ client: this.drizzleConnection })
|
||||||
}
|
}
|
||||||
// retry connection on failure some times to allow database to catch up
|
// retry connection on failure some times to allow database to catch up
|
||||||
|
|||||||
@ -16,7 +16,7 @@ let db: MySql2Database
|
|||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await appDB.init()
|
await appDB.init()
|
||||||
db = appDB.getDrizzleDataSource()
|
db = appDB.getDrizzleDataSource()
|
||||||
// await db.delete(openaiThreadsTable)
|
await db.delete(openaiThreadsTable)
|
||||||
})
|
})
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await appDB.destroy()
|
await appDB.destroy()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user