Repository navigation
fix(core): load asset protocol files asynchronously - #16050
Conversation
|
I think you might want to re-open #15836 instead |
|
I'd have liked to, but I deleted the fork that PR came from, so GitHub won't let me reopen it. This is the same change, rebased onto current dev. |
|
It's also smaller than #15836: just the handler change and a change file, without the FIFO test. Happy to add the test back if you want it. |
Got it, I'm fine with either one of them. Since everything here can be async (through tokio), we should revert the changes made in #15117 and mirror #15220 for it to run as an async task, no need to block here. |
Package Changes Through 89b276dThere are 14 changes which include tauri-cli with minor, @tauri-apps/cli with minor, tauri with minor, tauri-build with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, @tauri-apps/api with minor, tauri-bundler with minor, tauri-macos-sign with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor, tauri-driver with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
Done. It's async now like #15220: |
|
Any benchmark cloud be sharing? It seemed using async in sync scope makes no reason, unless using |
|
Also, |
|
There's no This isn't about speed, so I don't have a benchmark. The handler runs on the event loop thread, so a read that hangs (like a network share that's down) used to freeze every window. Now it doesn't. You're right that |
This is not about performance but rather not blocking the main thread on reading files.
That is only used in tests so... |
Fixes #7434.
If an
asset://file sits on a slow or unreachable path, like a network share that's down, the whole app freezes, every window. The handler reads the file right on the thread that runs the event loop.This makes the handler async, the same way #15220 did for
tauri://: file access goes back totokio::fs(undoing theasset.rspart of #15117), and the handler responds from a spawned task. Markpad has shipped the same idea as its ownassethandler since August.Verification on macOS arm64:
cargo test -p tauri --lib --all-features protocol::assetI also ran a local test (not included) that reads from a FIFO, which blocks like a dead share. It times out on
devand passes with this change.