How to cancel processing of async commands #5894
-
Hello! You are trying to execute an asynchronous command that takes several seconds to process each time a value is changed. However, if the value is changed too fast, a large number of threads will be created, resulting in 100% CPU utilization. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I solved mine by keeping a count in Tauri's Manager, adding 1 to the count each time the command is called, and terminating the process if the value has changed between when the processing function was called and now. |
Beta Was this translation helpful? Give feedback.
I solved mine by keeping a count in Tauri's Manager, adding 1 to the count each time the command is called, and terminating the process if the value has changed between when the processing function was called and now.