fix: global execution queue added

This commit is contained in:
Anirban Kar
2024-11-17 13:26:09 +05:30
parent b7d609d315
commit 358487135f
3 changed files with 30 additions and 9 deletions

View File

@@ -94,7 +94,7 @@ export class ActionRunner {
this.#updateAction(actionId, { ...action, ...data.action, executed: !isStreaming });
this.#currentExecutionPromise = this.#currentExecutionPromise
return this.#currentExecutionPromise = this.#currentExecutionPromise
.then(() => {
return this.#executeAction(actionId, isStreaming);
})
@@ -119,7 +119,14 @@ export class ActionRunner {
break;
}
case 'start': {
await this.#runStartAction(action)
// making the start app non blocking
this.#runStartAction(action).then(()=>this.#updateAction(actionId, { status: 'complete' }))
.catch(()=>this.#updateAction(actionId, { status: 'failed', error: 'Action failed' }))
// adding a delay to avoid any race condition between 2 start actions
// i am up for a better approch
await new Promise(resolve=>setTimeout(resolve,2000))
return
break;
}
}