mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 17:00:23 +00:00
feat: async snapshot refresh after heavy operations complete
This commit is contained in:
parent
871a1574db
commit
f612b191fc
1 changed files with 21 additions and 1 deletions
|
|
@ -2734,6 +2734,7 @@ class PaperForgeSettingTab extends PluginSettingTab {
|
|||
}
|
||||
// Refresh status regardless
|
||||
this._memoryStatusText = memoryState.getMemoryStatusText(vp);
|
||||
this._refreshSnapshots(vp);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -2774,11 +2775,29 @@ class PaperForgeSettingTab extends PluginSettingTab {
|
|||
this._lastSyncTime = new Date().toLocaleTimeString();
|
||||
this.plugin._lastSyncTime = this._lastSyncTime;
|
||||
}
|
||||
this.display(); // re-render
|
||||
this.display();
|
||||
this._refreshSnapshots(vp);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_refreshSnapshots(vp) {
|
||||
const py = memoryState.getCachedPython(vp, this.plugin.settings);
|
||||
const { execFile } = require('node:child_process');
|
||||
const args = [...py.extraArgs, '-m', 'paperforge', '--vault', vp, 'runtime-health', '--json'];
|
||||
|
||||
this._refreshPending = true;
|
||||
|
||||
execFile(py.path, args, { cwd: vp, timeout: 30000, windowsHide: true },
|
||||
(err, stdout, stderr) => {
|
||||
this._refreshPending = false;
|
||||
this._memoryStatusText = memoryState.getMemoryStatusText(vp);
|
||||
this._embedStatusText = memoryState.getVectorStatusText(vp);
|
||||
this.display();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
_renderFeaturesTab(containerEl) {
|
||||
// --- Section: Skills ---
|
||||
containerEl.createEl('h3', { text: 'Skills' });
|
||||
|
|
@ -3443,6 +3462,7 @@ class PaperForgeSettingTab extends PluginSettingTab {
|
|||
}
|
||||
this._embedStderr = '';
|
||||
this.display();
|
||||
this._refreshSnapshots(vp);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue