forked from 1b-agent/opencadstudio-upstream
plugin: parallel release fetches, faster shutdown, uninstall runner stop
- Run Plugin Manager release fetches on OS threads so they execute in parallel instead of serialising on the async executor. - Reduce V4Connection shutdown poll from 3s to 100ms; the runner is killed and reaped without blocking host shutdown. - Add PluginManager::remove and PluginProcess::shutdown_and_wait so uninstall can stop the runner before deleting files, fixing Windows access-denied errors on plugin removal. - Rebuild ribbon immediately after uninstall so the tab disappears.
This commit is contained in:
1 parent
285d35182c
commit
83d7a4d7db
6 files changed
+75
-7
No files matched your search
+12
-2
@@ -477,12 +477,22 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
/// Background task: fetch `owner/repo`'s installable releases and their
|
||||
/// manifest API versions.
|
||||
/// manifest API versions. The fetch runs on its own OS thread because the
|
||||
/// several sequential HTTP requests inside `fetch_release_info` would
|
||||
/// otherwise block the async executor and serialise all repo fetches.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(in crate::app) fn fetch_releases_task(&self, repo: String) -> Task<Message> {
|
||||
let label = repo.clone();
|
||||
Task::perform(
|
||||
async move { crate::plugin::marketplace::fetch_release_info(&repo) },
|
||||
async move {
|
||||
let (tx, rx) = iced::futures::channel::oneshot::channel();
|
||||
std::thread::spawn(move || {
|
||||
let result = crate::plugin::marketplace::fetch_release_info(&repo);
|
||||
let _ = tx.send(result);
|
||||
});
|
||||
rx.await
|
||||
.unwrap_or_else(|_| Err("release fetch thread died".into()))
|
||||
},
|
||||
move |res| Message::PluginReleasesFetched(label, res),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -5990,11 +5990,16 @@ impl OpenCADStudio {
|
||||
Message::PluginUninstall(id) => {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
// Stop the plugin runner first so Windows releases the DLL
|
||||
// and allows the package directory to be deleted.
|
||||
crate::plugin::external::remove_plugin(&id);
|
||||
match crate::plugin::external::uninstall(&id) {
|
||||
Ok(()) => {
|
||||
self.marketplace_status =
|
||||
format!("Uninstalled '{id}'. Restart to unload it.");
|
||||
format!("Uninstalled '{id}'.");
|
||||
self.plugin_load_errors.remove(&id);
|
||||
self.loaded_plugin_ids.remove(&id);
|
||||
self.rebuild_ribbon_modules();
|
||||
self.external_plugins = crate::plugin::external::discover();
|
||||
}
|
||||
Err(e) => {
|
||||
|
||||
Reference in new issue
Block a user