Merge branch 'master' into fix/buffer-in-backend-js

This commit is contained in:
Sam Rose 2024-07-24 15:45:20 +01:00 committed by GitHub
commit 26fe887eea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 0 deletions

View File

@ -80,18 +80,31 @@ export async function startup(
const address = server.address() as AddressInfo
env._set("PORT", address.port)
}
console.log("Emitting port event")
eventEmitter.emitPort(env.PORT)
console.log("Initialising file system")
fileSystem.init()
console.log("Initialising redis")
await redis.init()
console.log("Initialising writethrough cache")
cache.docWritethrough.init()
console.log("Initialising events")
eventInit()
if (app && server) {
console.log("Initialising websockets")
initialiseWebsockets(app, server)
}
// run migrations on startup if not done via http
// not recommended in a clustered environment
if (!env.HTTP_MIGRATIONS && !env.isTest()) {
console.log("Running migrations")
try {
await migrations.migrate()
} catch (e) {
@ -107,12 +120,15 @@ export async function startup(
env.PLUGINS_DIR &&
fs.existsSync(env.PLUGINS_DIR)
) {
console.log("Monitoring plugin directory")
watch()
}
// check for version updates
console.log("Checking for version updates")
await installation.checkInstallVersion()
console.log("Initialising queues")
// get the references to the queue promises, don't await as
// they will never end, unless the processing stops
let queuePromises = []
@ -126,6 +142,7 @@ export async function startup(
}
queuePromises.push(initPro())
if (app) {
console.log("Initialising routes")
// bring routes online as final step once everything ready
await initRoutes(app)
}
@ -141,6 +158,7 @@ export async function startup(
bbAdminEmail &&
bbAdminPassword
) {
console.log("Initialising admin user")
const tenantId = tenancy.getTenantId()
await tenancy.doInTenant(tenantId, async () => {
const exists = await users.doesUserExist(bbAdminEmail)
@ -171,5 +189,6 @@ export async function startup(
})
}
console.log("Initialising JS runner")
jsRunner.init()
}