fix: queue on-create jobs sequentially and fix history ordering
All checks were successful
CI / test (pull_request) Successful in 13s
CI / build-dev (pull_request) Has been skipped

runJobsOnCreate now awaits each job before starting the next,
ensuring they don't stomp each other's DB writes in parallel.

getInstanceHistory changed to ORDER BY changed_at ASC, id ASC so
the creation event (lowest id) is always first regardless of
same-second timestamps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-28 20:09:32 -04:00
parent 817fdaef13
commit 8f35724bde
2 changed files with 4 additions and 2 deletions

View File

@@ -227,7 +227,7 @@ export function importInstances(rows, historyRows = []) {
export function getInstanceHistory(vmid) {
return db.prepare(
'SELECT * FROM instance_history WHERE vmid = ? ORDER BY changed_at DESC'
'SELECT * FROM instance_history WHERE vmid = ? ORDER BY changed_at ASC, id ASC'
).all(vmid);
}