Quick update, just to cover both queue add functions.

This commit is contained in:
mike12345567 2021-11-16 19:02:55 +00:00
parent ba4c79895f
commit 3fdfc95298
1 changed files with 7 additions and 9 deletions

View File

@ -11,6 +11,10 @@ const utils = require("./utils")
const env = require("../environment")
const TRIGGER_DEFINITIONS = definitions
const JOB_OPTS = {
removeOnComplete: true,
removeOnFail: true,
}
async function queueRelevantRowAutomations(event, eventType) {
if (event.appId == null) {
@ -47,13 +51,7 @@ async function queueRelevantRowAutomations(event, eventType) {
automationTrigger.inputs &&
automationTrigger.inputs.tableId === event.row.tableId
) {
await queue.add(
{ automation, event },
{
removeOnComplete: true,
removeOnFail: true,
}
)
await queue.add({ automation, event }, JOB_OPTS)
}
}
}
@ -92,7 +90,7 @@ exports.externalTrigger = async function (
automation.definition.trigger != null &&
automation.definition.trigger.stepId === definitions.APP.stepId &&
automation.definition.trigger.stepId === "APP" &&
!checkTestFlag(automation._id)
!(await checkTestFlag(automation._id))
) {
// values are likely to be submitted as strings, so we shall convert to correct type
const coercedFields = {}
@ -106,7 +104,7 @@ exports.externalTrigger = async function (
if (getResponses) {
return utils.processEvent({ data })
} else {
return queue.add(data)
return queue.add(data, JOB_OPTS)
}
}