Quick update, just to cover both queue add functions.
This commit is contained in:
parent
ba4c79895f
commit
3fdfc95298
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue