mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 06:17:27 +00:00
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:
1 parent
fc02c4b968
commit
36e8ed5d87
9 files changed
+115
-11
No files matched your search
@@ -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();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user