Fix: Abort fetch requests on timeout in SimStudioClien
Summary
This PR addresses a critical resource management and performance issue in the SimStudioClient by implementing proper request abortion for timed-out fetch calls.
Problem
Previously, the executeWorkflow method used Promise.race to handle timeouts. While this approach rejected the timeout promise, the underlying fetch request continued running in the background, leading to:
- Resource Leaks: Network connections remained open, increasing memory consumption.
- Performance Degradation: Continued background activity added unnecessary load.
- Unpredictable Behavior: Late server responses to already timed-out requests could lead to inconsistent client state.
Solution
The method is refactored to use the AbortController API for more robust timeout handling:
- A new
AbortControlleris created for eachfetchrequest. - A
setTimeoutis used to triggerabortController.abort()after the configured timeout period. - The controller’s
signalis passed to thefetchoptions to enable cancellation. clearTimeoutis called once the request completes, preventing stale timeouts.- Error handling is enhanced to catch
AbortErrorand provide clear messaging for timeout events.
Benefits
- ✅ Improved Resource Management — Cleans up network and memory resources on timeout.
- ✅ Enhanced Performance — Prevents wasteful processing by halting stalled requests.
- ✅ Predictable Behavior — Ensures client-side state remains consistent by terminating timed-out calls.
- ✅ Best Practice Compliance — Aligns with modern JavaScript standards for request cancellation.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| docs | ⬜️ Skipped (Inspect) | Jul 10, 2025 9:56pm |
@SyedaAnshrahGillani is attempting to deploy a commit to the Sim Studio Team on Vercel.
A member of the Team first needs to authorize it.