fix: watcher startup grace period, defensive runtime drop on reload
This commit is contained in:
@@ -69,9 +69,17 @@ fn watch_loop(
|
||||
|
||||
info!("Watching {} for plugin changes", plugins_dir.display());
|
||||
|
||||
// Skip events during initial startup grace period (watcher setup triggers events)
|
||||
let startup = std::time::Instant::now();
|
||||
let grace_period = Duration::from_secs(2);
|
||||
|
||||
loop {
|
||||
match rx.recv() {
|
||||
Ok(Ok(events)) => {
|
||||
if startup.elapsed() < grace_period {
|
||||
continue;
|
||||
}
|
||||
|
||||
let has_relevant_change = events.iter().any(|e| {
|
||||
matches!(
|
||||
e.kind,
|
||||
|
||||
@@ -292,8 +292,11 @@ impl ProviderManager {
|
||||
!self.runtime_type_ids.contains(&type_str)
|
||||
});
|
||||
|
||||
// Drop old runtimes
|
||||
self.runtimes.clear();
|
||||
// Drop old runtimes (catch panics from runtime cleanup)
|
||||
let old_runtimes = std::mem::take(&mut self.runtimes);
|
||||
drop(std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||
drop(old_runtimes);
|
||||
})));
|
||||
self.runtime_type_ids.clear();
|
||||
|
||||
let owlry_version = env!("CARGO_PKG_VERSION");
|
||||
|
||||
Reference in New Issue
Block a user