mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 01:31:08 +00:00
fix: release local heavy-check locks on success
This commit is contained in:
@@ -133,6 +133,9 @@ export function acquireLocalHeavyCheckLockSync(params) {
|
||||
let lastProgressAt = 0;
|
||||
|
||||
fs.mkdirSync(locksDir, { recursive: true });
|
||||
if (!params.lockName) {
|
||||
cleanupLegacyLockDirs(locksDir, staleLockMs);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
try {
|
||||
@@ -210,6 +213,20 @@ export function resolveGitCommonDir(cwd) {
|
||||
return path.join(cwd, ".git");
|
||||
}
|
||||
|
||||
function cleanupLegacyLockDirs(locksDir, staleLockMs) {
|
||||
for (const legacyLockName of ["test"]) {
|
||||
const legacyLockDir = path.join(locksDir, `${legacyLockName}.lock`);
|
||||
if (!fs.existsSync(legacyLockDir)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const owner = readOwnerFile(path.join(legacyLockDir, "owner.json"));
|
||||
if (shouldReclaimLock({ owner, lockDir: legacyLockDir, staleLockMs })) {
|
||||
fs.rmSync(legacyLockDir, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function insertBeforeSeparator(args, ...items) {
|
||||
if (items.length > 0 && hasFlag(args, items[0])) {
|
||||
return;
|
||||
|
||||
@@ -18,6 +18,7 @@ export function runExtensionOxlint(params) {
|
||||
});
|
||||
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), params.tempDirPrefix));
|
||||
const tempConfigPath = path.join(tempDir, "oxlint.json");
|
||||
let exitCode = 0;
|
||||
|
||||
try {
|
||||
prepareExtensionPackageBoundaryArtifacts(repoRoot);
|
||||
@@ -45,11 +46,13 @@ export function runExtensionOxlint(params) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
exitCode = result.status ?? 1;
|
||||
} finally {
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
releaseLock();
|
||||
}
|
||||
|
||||
process.exitCode = exitCode;
|
||||
}
|
||||
|
||||
function prepareExtensionPackageBoundaryArtifacts(repoRoot) {
|
||||
@@ -59,6 +62,7 @@ function prepareExtensionPackageBoundaryArtifacts(repoRoot) {
|
||||
toolName: "extension-package-boundary-artifacts",
|
||||
lockName: "extension-package-boundary-artifacts",
|
||||
});
|
||||
let exitCode = 0;
|
||||
|
||||
try {
|
||||
const result = spawnSync(
|
||||
@@ -75,12 +79,14 @@ function prepareExtensionPackageBoundaryArtifacts(repoRoot) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
if ((result.status ?? 1) !== 0) {
|
||||
process.exit(result.status ?? 1);
|
||||
}
|
||||
exitCode = result.status ?? 1;
|
||||
} finally {
|
||||
releaseLock();
|
||||
}
|
||||
|
||||
if (exitCode !== 0) {
|
||||
process.exitCode = exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
function writeTempOxlintConfig(repoRoot, configPath) {
|
||||
|
||||
@@ -25,7 +25,7 @@ try {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
process.exitCode = result.status ?? 1;
|
||||
} finally {
|
||||
releaseLock();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ try {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
process.exitCode = result.status ?? 1;
|
||||
} finally {
|
||||
releaseLock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user