1
0
Fork 0
mirror of synced 2024-10-01 09:38:55 +13:00

Hook redis init flow into overall worker init flow.

This commit is contained in:
Sam Rose 2023-11-10 11:39:26 +00:00
parent dd2f68d099
commit 94983c289f
No known key found for this signature in database
4 changed files with 8 additions and 4 deletions

View file

@ -37,6 +37,7 @@ export { SearchParams } from "./db"
// circular dependencies
import * as context from "./context"
import * as _tenancy from "./tenancy"
import * as redis from "./redis"
export const tenancy = {
..._tenancy,
...context,
@ -50,6 +51,8 @@ export * from "./constants"
// expose package init function
import * as db from "./db"
export const init = (opts: any = {}) => {
export const init = async (opts: any = {}) => {
db.init(opts.db)
await redis.init()
}

View file

@ -4,6 +4,7 @@ export { default as Client } from "./redis"
export * as utils from "./utils"
export * as clients from "./init"
export * as locks from "./redlockImpl"
export * from "./init"
export * from "./invite"
export * from "./passwordReset"

View file

@ -11,7 +11,7 @@ let userClient: Client,
inviteClient: Client,
passwordResetClient: Client
async function init() {
export async function init() {
userClient = await new Client(utils.Databases.USER_CACHE).init()
sessionClient = await new Client(utils.Databases.SESSIONS).init()
appClient = await new Client(utils.Databases.APP_METADATA).init()

View file

@ -1,7 +1,7 @@
import * as core from "@budibase/backend-core"
import env from "../environment"
export function init() {
export async function init() {
const dbConfig: any = {
replication: true,
find: true,
@ -12,5 +12,5 @@ export function init() {
dbConfig.allDbs = true
}
core.init({ db: dbConfig })
await core.init({ db: dbConfig })
}