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
@@ -722,6 +722,28 @@ impl PluginProcess {
|
||||
}
|
||||
}
|
||||
|
||||
/// Tear down the plugin process and block until the child exits or the
|
||||
/// timeout elapses. Use this when the caller needs the DLL/files to be
|
||||
/// released before continuing (e.g. uninstalling a plugin on Windows).
|
||||
pub fn shutdown_and_wait(&self, timeout: Duration) -> Option<std::process::ExitStatus> {
|
||||
if let Some(v4) = &self.v4 {
|
||||
v4.shutdown();
|
||||
}
|
||||
let (stream, child) = self.take_resources();
|
||||
drop(stream);
|
||||
if let Some(mut child) = child {
|
||||
let _ = child.kill();
|
||||
let start = Instant::now();
|
||||
while start.elapsed() < timeout {
|
||||
if let Ok(Some(status)) = child.try_wait() {
|
||||
return Some(status);
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Take the stream and child handles out of the process. After this the
|
||||
/// process is considered shut down and any further IPC will fail.
|
||||
fn take_resources(&self) -> (Option<Stream>, Option<Child>) {
|
||||
|
||||
Reference in new issue
Block a user