Adding backup queue to bullboard if enabled.
This commit is contained in:
parent
6228d3346e
commit
51251b1fe2
|
@ -54,19 +54,6 @@ app.use(
|
|||
})
|
||||
)
|
||||
|
||||
app.use(pino(pinoSettings()))
|
||||
|
||||
if (!env.isTest()) {
|
||||
const plugin = bullboard.init()
|
||||
app.use(plugin)
|
||||
}
|
||||
|
||||
app.context.eventEmitter = eventEmitter
|
||||
app.context.auth = {}
|
||||
|
||||
// api routes
|
||||
app.use(api.router.routes())
|
||||
|
||||
if (env.isProd()) {
|
||||
env._set("NODE_ENV", "production")
|
||||
Sentry.init()
|
||||
|
@ -104,7 +91,22 @@ server.on("close", async () => {
|
|||
}
|
||||
})
|
||||
|
||||
const initPro = async () => {
|
||||
async function initRoutes() {
|
||||
app.use(pino(pinoSettings()))
|
||||
|
||||
if (!env.isTest()) {
|
||||
const plugin = await bullboard.init()
|
||||
app.use(plugin)
|
||||
}
|
||||
|
||||
app.context.eventEmitter = eventEmitter
|
||||
app.context.auth = {}
|
||||
|
||||
// api routes
|
||||
app.use(api.router.routes())
|
||||
}
|
||||
|
||||
async function initPro() {
|
||||
await pro.init({
|
||||
backups: {
|
||||
processing: {
|
||||
|
@ -179,11 +181,13 @@ module.exports = server.listen(env.PORT || 0, async () => {
|
|||
// check for version updates
|
||||
await installation.checkInstallVersion()
|
||||
|
||||
// done last - these will never complete
|
||||
let promises = []
|
||||
promises.push(automations.init())
|
||||
promises.push(initPro())
|
||||
await Promise.all(promises)
|
||||
// get the references to the queue promises, don't await as
|
||||
// they will never end, unless the processing stops
|
||||
let queuePromises = []
|
||||
queuePromises.push(automations.init())
|
||||
queuePromises.push(initPro())
|
||||
// bring routes online as final step once everything ready
|
||||
await initRoutes()
|
||||
})
|
||||
|
||||
const shutdown = () => {
|
||||
|
|
|
@ -3,6 +3,7 @@ const { BullAdapter } = require("@bull-board/api/bullAdapter")
|
|||
const { KoaAdapter } = require("@bull-board/koa")
|
||||
const { queue } = require("@budibase/backend-core")
|
||||
const automation = require("../threads/automation")
|
||||
const { backups } = require("@budibase/pro")
|
||||
|
||||
let automationQueue = queue.createQueue(
|
||||
queue.JobQueue.AUTOMATION,
|
||||
|
@ -11,9 +12,13 @@ let automationQueue = queue.createQueue(
|
|||
|
||||
const PATH_PREFIX = "/bulladmin"
|
||||
|
||||
exports.init = () => {
|
||||
exports.init = async () => {
|
||||
// Set up queues for bull board admin
|
||||
const backupQueue = await backups.getBackupQueue()
|
||||
const queues = [automationQueue]
|
||||
if (backupQueue) {
|
||||
queues.push(backupQueue)
|
||||
}
|
||||
const adapters = []
|
||||
const serverAdapter = new KoaAdapter()
|
||||
for (let queue of queues) {
|
||||
|
|
Loading…
Reference in New Issue