mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 02:32:56 +00:00
Cron: clean run-log write queue entries (#23968)
* Cron: clean run-log write queue entries * Changelog: add cron run-log write-queue cleanup note
This commit is contained in:
@@ -27,6 +27,10 @@ export function resolveCronRunLogPath(params: { storePath: string; jobId: string
|
||||
|
||||
const writesByPath = new Map<string, Promise<void>>();
|
||||
|
||||
export function getPendingCronRunLogWriteCountForTests() {
|
||||
return writesByPath.size;
|
||||
}
|
||||
|
||||
async function pruneIfNeeded(filePath: string, opts: { maxBytes: number; keepLines: number }) {
|
||||
const stat = await fs.stat(filePath).catch(() => null);
|
||||
if (!stat || stat.size <= opts.maxBytes) {
|
||||
@@ -63,7 +67,13 @@ export async function appendCronRunLog(
|
||||
});
|
||||
});
|
||||
writesByPath.set(resolved, next);
|
||||
await next;
|
||||
try {
|
||||
await next;
|
||||
} finally {
|
||||
if (writesByPath.get(resolved) === next) {
|
||||
writesByPath.delete(resolved);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function readCronRunLogEntries(
|
||||
|
||||
Reference in New Issue
Block a user