Renaming some queue to automationQueue, getting build working.
This commit is contained in:
parent
50ca437f03
commit
9c57300030
|
@ -64,6 +64,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/chance": "1.1.3",
|
||||
"@types/ioredis": "^4.28.10",
|
||||
"@types/jest": "27.5.1",
|
||||
"@types/koa": "2.0.52",
|
||||
"@types/lodash": "4.14.180",
|
||||
|
|
|
@ -768,6 +768,13 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-1.8.2.tgz#7315b4c4c54f82d13fa61c228ec5c2ea5cc9e0e1"
|
||||
integrity sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==
|
||||
|
||||
"@types/ioredis@^4.28.10":
|
||||
version "4.28.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/ioredis/-/ioredis-4.28.10.tgz#40ceb157a4141088d1394bb87c98ed09a75a06ff"
|
||||
integrity sha512-69LyhUgrXdgcNDv7ogs1qXZomnfOEnSmrmMFqKgt1XMJxmoOSG/u3wYy13yACIfKuMJ8IhKgHafDO3sx19zVQQ==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44"
|
||||
|
|
|
@ -4,7 +4,7 @@ const { KoaAdapter } = require("@bull-board/koa")
|
|||
const { queue } = require("@budibase/backend-core")
|
||||
const listeners = require("./listeners")
|
||||
|
||||
let automationQueue = queue.createQueue(queue.JobQueues.AUTOMATIONS)
|
||||
let automationQueue = queue.createQueue(queue.JobQueue.AUTOMATIONS)
|
||||
listeners.addListeners(automationQueue)
|
||||
|
||||
const PATH_PREFIX = "/bulladmin"
|
||||
|
@ -29,4 +29,4 @@ exports.shutdown = async () => {
|
|||
await queue.shutdown()
|
||||
}
|
||||
|
||||
exports.queue = automationQueue
|
||||
exports.automationQueue = automationQueue
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { processEvent } = require("./utils")
|
||||
const { queue, shutdown } = require("./bullboard")
|
||||
const { automationQueue, shutdown } = require("./bullboard")
|
||||
const { TRIGGER_DEFINITIONS, rebootTrigger } = require("./triggers")
|
||||
const { ACTION_DEFINITIONS } = require("./actions")
|
||||
|
||||
|
@ -8,7 +8,7 @@ const { ACTION_DEFINITIONS } = require("./actions")
|
|||
*/
|
||||
exports.init = async function () {
|
||||
// this promise will not complete
|
||||
const promise = queue.process(async job => {
|
||||
const promise = automationQueue.process(async job => {
|
||||
await processEvent(job)
|
||||
})
|
||||
// on init we need to trigger any reboot automations
|
||||
|
@ -17,13 +17,13 @@ exports.init = async function () {
|
|||
}
|
||||
|
||||
exports.getQueues = () => {
|
||||
return [queue]
|
||||
return [automationQueue]
|
||||
}
|
||||
|
||||
exports.shutdown = () => {
|
||||
return shutdown()
|
||||
}
|
||||
|
||||
exports.queue = queue
|
||||
exports.automationQueue = automationQueue
|
||||
exports.TRIGGER_DEFINITIONS = TRIGGER_DEFINITIONS
|
||||
exports.ACTION_DEFINITIONS = ACTION_DEFINITIONS
|
||||
|
|
|
@ -4,7 +4,7 @@ const { coerce } = require("../utilities/rowProcessor")
|
|||
const { definitions } = require("./triggerInfo")
|
||||
const { isDevAppID } = require("../db/utils")
|
||||
// need this to call directly, so we can get a response
|
||||
const { queue } = require("./bullboard")
|
||||
const { automationQueue } = require("./bullboard")
|
||||
const { checkTestFlag } = require("../utilities/redis")
|
||||
const utils = require("./utils")
|
||||
const env = require("../environment")
|
||||
|
@ -56,7 +56,7 @@ async function queueRelevantRowAutomations(event, eventType) {
|
|||
automationTrigger.inputs &&
|
||||
automationTrigger.inputs.tableId === event.row.tableId
|
||||
) {
|
||||
await queue.add({ automation, event }, JOB_OPTS)
|
||||
await automationQueue.add({ automation, event }, JOB_OPTS)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -110,7 +110,7 @@ exports.externalTrigger = async function (
|
|||
if (getResponses) {
|
||||
return utils.processEvent({ data })
|
||||
} else {
|
||||
return queue.add(data, JOB_OPTS)
|
||||
return automationQueue.add(data, JOB_OPTS)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ exports.rebootTrigger = async () => {
|
|||
timestamp: Date.now(),
|
||||
},
|
||||
}
|
||||
rebootEvents.push(queue.add(job, JOB_OPTS))
|
||||
rebootEvents.push(automationQueue.add(job, JOB_OPTS))
|
||||
}
|
||||
}
|
||||
await Promise.all(rebootEvents)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Thread, ThreadType } from "../threads"
|
||||
import { definitions } from "./triggerInfo"
|
||||
import * as webhooks from "../api/controllers/webhook"
|
||||
import { queue } from "./bullboard"
|
||||
import { automationQueue } from "./bullboard"
|
||||
import newid from "../db/newid"
|
||||
import { updateEntityMetadata } from "../utilities"
|
||||
import { MetadataTypes, WebhookType } from "../constants"
|
||||
|
@ -79,12 +79,12 @@ export function removeDeprecated(definitions: any) {
|
|||
// end the repetition and the job itself
|
||||
export async function disableAllCrons(appId: any) {
|
||||
const promises = []
|
||||
const jobs = await queue.getRepeatableJobs()
|
||||
const jobs = await automationQueue.getRepeatableJobs()
|
||||
for (let job of jobs) {
|
||||
if (job.key.includes(`${appId}_cron`)) {
|
||||
promises.push(queue.removeRepeatableByKey(job.key))
|
||||
promises.push(automationQueue.removeRepeatableByKey(job.key))
|
||||
if (job.id) {
|
||||
promises.push(queue.removeJobs(job.id))
|
||||
promises.push(automationQueue.removeJobs(job.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ export async function disableAllCrons(appId: any) {
|
|||
}
|
||||
|
||||
export async function disableCron(jobId: string, jobKey: string) {
|
||||
await queue.removeRepeatableByKey(jobKey)
|
||||
await queue.removeJobs(jobId)
|
||||
await automationQueue.removeRepeatableByKey(jobKey)
|
||||
await automationQueue.removeJobs(jobId)
|
||||
console.log(`jobId=${jobId} disabled`)
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ export async function enableCronTrigger(appId: any, automation: Automation) {
|
|||
) {
|
||||
// make a job id rather than letting Bull decide, makes it easier to handle on way out
|
||||
const jobId = `${appId}_cron_${newid()}`
|
||||
const job: any = await queue.add(
|
||||
const job: any = await automationQueue.add(
|
||||
{
|
||||
automation,
|
||||
event: { appId, timestamp: Date.now() },
|
||||
|
|
Loading…
Reference in New Issue