1
0
Fork 0
mirror of synced 2024-07-04 14:01:27 +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 env = require("../environment")
const TRIGGER_DEFINITIONS = definitions const TRIGGER_DEFINITIONS = definitions
const JOB_OPTS = {
removeOnComplete: true,
removeOnFail: true,
}
async function queueRelevantRowAutomations(event, eventType) { async function queueRelevantRowAutomations(event, eventType) {
if (event.appId == null) { if (event.appId == null) {
@ -47,13 +51,7 @@ async function queueRelevantRowAutomations(event, eventType) {
automationTrigger.inputs && automationTrigger.inputs &&
automationTrigger.inputs.tableId === event.row.tableId automationTrigger.inputs.tableId === event.row.tableId
) { ) {
await queue.add( await queue.add({ automation, event }, JOB_OPTS)
{ automation, event },
{
removeOnComplete: true,
removeOnFail: true,
}
)
} }
} }
} }
@ -92,7 +90,7 @@ exports.externalTrigger = async function (
automation.definition.trigger != null && automation.definition.trigger != null &&
automation.definition.trigger.stepId === definitions.APP.stepId && automation.definition.trigger.stepId === definitions.APP.stepId &&
automation.definition.trigger.stepId === "APP" && 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 // values are likely to be submitted as strings, so we shall convert to correct type
const coercedFields = {} const coercedFields = {}
@ -106,7 +104,7 @@ exports.externalTrigger = async function (
if (getResponses) { if (getResponses) {
return utils.processEvent({ data }) return utils.processEvent({ data })
} else { } else {
return queue.add(data) return queue.add(data, JOB_OPTS)
} }
} }