🐛 Fix bug that not all Trigger-Nodes got updated/removed

This commit is contained in:
Jan Oberhauser 2020-01-10 13:38:55 -06:00
parent 83c49ddd21
commit 8b1fe83cc0
2 changed files with 21 additions and 9 deletions

View file

@ -75,17 +75,21 @@ export class ActiveWorkflows {
const triggerNodes = workflow.getTriggerNodes();
let triggerResponse: ITriggerResponse | undefined;
this.workflowData[id].triggerResponses = [];
for (const triggerNode of triggerNodes) {
triggerResponse = await workflow.runTrigger(triggerNode, getTriggerFunctions, additionalData, 'trigger');
if (triggerResponse !== undefined) {
// If a response was given save it
this.workflowData[id].triggerResponse = triggerResponse;
this.workflowData[id].triggerResponses!.push(triggerResponse);
}
}
const pollNodes = workflow.getPollNodes();
for (const pollNode of pollNodes) {
this.workflowData[id].pollResponse = await this.activatePolling(pollNode, workflow, additionalData, getPollFunctions);
if (pollNodes.length) {
this.workflowData[id].pollResponses = [];
for (const pollNode of pollNodes) {
this.workflowData[id].pollResponses!.push(await this.activatePolling(pollNode, workflow, additionalData, getPollFunctions));
}
}
}
@ -212,12 +216,20 @@ export class ActiveWorkflows {
const workflowData = this.workflowData[id];
if (workflowData.triggerResponse && workflowData.triggerResponse.closeFunction) {
await workflowData.triggerResponse.closeFunction();
if (workflowData.triggerResponses) {
for (const triggerResponse of workflowData.triggerResponses) {
if (triggerResponse.closeFunction) {
await triggerResponse.closeFunction();
}
}
}
if (workflowData.pollResponse && workflowData.pollResponse.closeFunction) {
await workflowData.pollResponse.closeFunction();
if (workflowData.pollResponses) {
for (const pollResponse of workflowData.pollResponses) {
if (pollResponse.closeFunction) {
await pollResponse.closeFunction();
}
}
}
delete this.workflowData[id];

View file

@ -123,7 +123,7 @@ export interface INodeInputDataConnections {
export interface IWorkflowData {
pollResponse?: IPollResponse;
triggerResponse?: ITriggerResponse;
pollResponses?: IPollResponse[];
triggerResponses?: ITriggerResponse[];
workflow: Workflow;
}