Command lifecycle behavior when closing the Tauri window during async execution
0 reputation · 17 Aug 2022, 09:08 UTC
Asynchronous Command Termination
Tauri allows the execution of asynchronous Rust commands via the async keyword, which prevents the main thread from blocking during long-running operations. While the frontend can manage the promise lifecycle, the behavior of the backend task during an abrupt window closure is less clear.
When a user closes the application window while an async command is still processing a heavy task in the Rust core, it is uncertain whether the underlying Tokio task is immediately cancelled or if it continues to execute until completion or a natural timeout.
What is the default lifecycle behavior for an active asynchronous command when its originating window is destroyed? Does Tauri provide a native mechanism to signal cancellation to the Rust backend upon window closure?