Browse Source

fix: repeat task block only execute once

Ahmad Kholid 2 years ago
parent
commit
df01fe3b09

+ 1 - 1
src/newtab/utils/workflowEngine/WorkflowEngine.js

@@ -429,7 +429,7 @@ class WorkflowEngine {
         }
       );
 
-      if (!this.workflow.isTesting) {
+      if (!this.workflow?.isTesting) {
         const { name, id, teamId } = this.workflow;
 
         await this.logger.add({

+ 1 - 1
src/newtab/utils/workflowEngine/blocksHandler/handlerRepeatTask.js

@@ -2,7 +2,7 @@ function repeatTask({ data, id }) {
   return new Promise((resolve) => {
     const repeat = Number.isNaN(+data.repeatFor) ? 0 : +data.repeatFor;
 
-    if (this.repeatedTasks[id] > repeat) {
+    if (this.repeatedTasks[id] > repeat || !this.getBlockConnections(id, 2)) {
       delete this.repeatedTasks[id];
 
       resolve({