mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 01:39:52 +08:00
perf(cron): share global concurrency budget and streamline execution
Share durable permits across manual, scheduled and recovered runs, prioritize short ready tasks with aging, and record global queue occupancy. Reduce launch, log polling, dashboard and SQLite overhead while preserving transactional receipts, cancellation, recovery and script hook compatibility. Keep ordinary CRUD in ORM and bound SQL on measured execution hot paths. Fix supervisor descendant tracking, asynchronous log draining, concurrent log directory creation, Linux fallback launches and snapshot clock rollback. Include regression coverage, SQL audits and evolution/review documentation. Validation: five review rounds; local full suite 1478 passed, 28 platform skips; dev suites 415 passed, no failures/skips; backend types and formatting passed.
This commit is contained in:
1 parent
cddabbaf0e
commit
2f01f756d7
74 files changed
+6891
-837
No files matched your search
@@ -48,3 +48,47 @@ test('file access enforces directory boundaries, blacklist descendants and symli
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
for (const kind of [
|
||||
'directory',
|
||||
'outside-link',
|
||||
'dangling-link',
|
||||
'swapped-directory',
|
||||
]) {
|
||||
test(`concurrent path creation preserves containment checks: ${kind}`, (t) => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ql-file-race-'));
|
||||
t.after(() => fs.rmSync(tmp, { recursive: true, force: true }));
|
||||
const root = path.join(tmp, 'logs');
|
||||
const directory = path.join(root, 'shared-script');
|
||||
const outside = path.join(tmp, 'outside');
|
||||
fs.mkdirSync(root);
|
||||
fs.mkdirSync(outside);
|
||||
const exists = fs.existsSync;
|
||||
t.mock.method(fs, 'existsSync', (file) => {
|
||||
if (file === directory && !exists(directory)) {
|
||||
if (kind === 'outside-link') fs.symlinkSync(outside, directory);
|
||||
else if (kind === 'dangling-link')
|
||||
fs.symlinkSync(path.join(outside, 'missing'), directory);
|
||||
else fs.mkdirSync(directory);
|
||||
// Simulate an earlier existsSync result racing with another writer.
|
||||
return false;
|
||||
}
|
||||
return exists(file);
|
||||
});
|
||||
if (kind === 'swapped-directory') {
|
||||
const lstat = fs.lstatSync;
|
||||
t.mock.method(fs, 'lstatSync', (file, ...args) => {
|
||||
const entry = lstat(file, ...args);
|
||||
if (file === directory) {
|
||||
fs.rmdirSync(directory);
|
||||
fs.symlinkSync(outside, directory);
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
}
|
||||
assert.equal(
|
||||
resolveFileAccess(root, ['shared-script/task.log']),
|
||||
kind === 'directory' ? path.join(directory, 'task.log') : '',
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user