Does Electron Provide Built‑In Timeout Support for ipc.invoke?
0 reputation · 22 Jul 2024, 15:00 UTC
Goal
Gracefully cancel or timeout IPC calls and page loads in Electron.
Constraints
Electron’s promise‑based IPC has no timeout argument; developers must wrap calls in Promise.race. The underlying handler continues to run, potentially wasting CPU or I/O. Navigation events can be prevented with event.preventDefault(), but there is no generic timeout for page loads.
Unresolved Decision
An open issue proposes adding an optional timeout parameter to ipc.invoke, but no merge has occurred in the latest stable releases.
Question
What is the current status of built‑in timeout support for ipc.invoke, and how can developers best avoid resource waste when using Promise.race to simulate timeouts?