fix(management): serialize lifecycle maintenance paths

- serialize deleteInstance with the same profile and plugin-layout locks as ensure

- lock non-account marketplace normalization paths and ignore .locks as an instance source
This commit is contained in:
Tam Nhu Tran committed 2026-03-18 08:04:48 -04:00
1 parent fc02c4b968
commit 36e8ed5d87
9 files changed
+115 -11

No files matched your search

+14 -3
View File
@@ -153,15 +153,22 @@ class InstanceManager {
/**
* Delete instance for profile
*/
deleteInstance(profileName: string): void {
async deleteInstance(profileName: string): Promise<void> {
const instancePath = this.getInstancePath(profileName);
if (!fs.existsSync(instancePath)) {
return;
}
// Recursive delete
fs.rmSync(instancePath, { recursive: true, force: true });
await this.contextSyncLock.withLock(profileName, async () => {
await this.pluginLayoutLock.withNamedLock('__plugin-layout__', async () => {
if (!fs.existsSync(instancePath)) {
return;
}
fs.rmSync(instancePath, { recursive: true, force: true });
});
});
}
/**
@@ -173,6 +180,10 @@ class InstanceManager {
}
return fs.readdirSync(this.instancesDir).filter((name) => {
if (name.startsWith('.')) {
return false;
}
const instancePath = path.join(this.instancesDir, name);
return fs.statSync(instancePath).isDirectory();
});