From 5ce97d12ce1caa92f6caa049397b41d4d4cd73df Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 5 Jun 2024 04:33:07 +0530 Subject: [PATCH] feat: stop current workflow interpretation --- .../src/workflow-management/classes/Interpreter.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/src/workflow-management/classes/Interpreter.ts b/server/src/workflow-management/classes/Interpreter.ts index 69fa9a6c..e7755bd0 100644 --- a/server/src/workflow-management/classes/Interpreter.ts +++ b/server/src/workflow-management/classes/Interpreter.ts @@ -177,5 +177,19 @@ export class WorkflowInterpreter { this.socket.emit('finished'); }; + /** + * Stops the current process of the interpretation of the workflow. + * @returns {Promise} + */ + public stopInterpretation = async () => { + if (this.interpreter) { + logger.log('info', 'Stopping the interpretation.'); + await this.interpreter.stop(); + this.socket.emit('log', '----- The interpretation has been stopped -----', false); + } else { + logger.log('error', 'Cannot stop: No active interpretation.'); + } + }; + }