1
0
Fork 0
mirror of synced 2024-06-30 12:00:31 +12:00

Quick update, just to cover both queue add functions.

This commit is contained in:
mike12345567 2021-11-16 19:02:55 +00:00
parent 11debac115
commit e75a9d3d1d

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)
}
}