fix: queue on-create jobs sequentially and fix history ordering
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user