You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using tauri for a project and need to return an early response from a Rust command. The command then triggers a worker that updates the database in the background and once done it has to notify the JS code with the new data.
Am I right that the only way right now is to start a new thread on the runtime (Tokio) that emits an event with the new data. That thread would then be started by the Rust command and the command would then return he current data.
The problem I am facing is that the data has to be returned quite fast and the worker needs a good 1-2s to fully collect the data.
Maybe first class support for such a feature would be something that the community is interested in? I doubt that this is a use case a lot of people need, but it might come handy to some of them. A prod-macro could be used as a decorator that connects two functions together, one that returns the early result and one that returns the late result.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
I have been using tauri for a project and need to return an early response from a Rust command. The command then triggers a worker that updates the database in the background and once done it has to notify the JS code with the new data.
Am I right that the only way right now is to start a new thread on the runtime (Tokio) that emits an event with the new data. That thread would then be started by the Rust command and the command would then return he current data.
The problem I am facing is that the data has to be returned quite fast and the worker needs a good 1-2s to fully collect the data.
Maybe first class support for such a feature would be something that the community is interested in? I doubt that this is a use case a lot of people need, but it might come handy to some of them. A prod-macro could be used as a decorator that connects two functions together, one that returns the early result and one that returns the late result.
Beta Was this translation helpful? Give feedback.
All reactions