Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

fix(workflow): Make workflow execution asynchronous

google-labs-jules[bot]dd41d792af2a
diff --git a/fincept-terminal-desktop/src/services/workflowService.ts b/fincept-terminal-desktop/src/services/workflowService.ts
index 51a5e9b3d..494885781 100644
--- a/fincept-terminal-desktop/src/services/workflowService.ts
+++ b/fincept-terminal-desktop/src/services/workflowService.ts
@@ -89,14 +89,20 @@ class WorkflowService {
this.runningWorkflows.add(id);
workflow.status = 'running';
+ this.saveToStorage(); // Save the 'running' state
console.log(`[WorkflowService] Executing workflow: ${id}`);
- // Simulate workflow execution
- // In a real implementation, this would execute the nodes
-
- workflow.status = 'completed';
- this.runningWorkflows.delete(id);
+ // Simulate async workflow execution
+ setTimeout(() => {
+ const completedWorkflow = this.workflows.get(id);
+ if (completedWorkflow) {
+ completedWorkflow.status = 'completed';
+ this.runningWorkflows.delete(id);
+ this.saveToStorage(); // Save the 'completed' state
+ console.log(`[WorkflowService] Workflow ${id} completed`);
+ }
+ }, 100); // Simulate a 100ms execution time
}
async stopWorkflow(id: string): Promise<void> {