feat: add verified offline recovery and retire legacy send assembly

This commit is contained in:
abaishu0730 committed 2026-10-21 11:12:18 +08:00
1 parent 84e2f0d9ba
commit 1148aa6f14
19 files changed
+235 -24

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ class ScanDeliveries{
return ready;
}
acknowledge(id){const at=new Date().toISOString();this.db.prepare("UPDATE execution_deliveries SET status='delivered',payload=NULL,next_at=0,updated_at=?,delivered_at=? WHERE run_id=?").run(at,at,id);}
pendingSources(){return this.db.prepare("SELECT DISTINCT connection_id AS id FROM execution_deliveries WHERE status IN ('pending','error')").all().map(row=>row.id);}
failed(id,nextAt){const at=new Date().toISOString();this.db.prepare("UPDATE execution_deliveries SET status='error',attempts=attempts+1,next_at=?,updated_at=?,failed_at=? WHERE run_id=? AND status!='delivered'").run(nextAt,at,at,id);}
summary(connectionId){
const pending=this.db.prepare("SELECT COUNT(*) AS n,MIN(next_at) AS due,SUM(CASE WHEN status='error' THEN 1 ELSE 0 END) AS errors FROM execution_deliveries WHERE connection_id=? AND status!='delivered'").get(connectionId),history=this.db.prepare('SELECT MAX(failed_at) AS failed,MAX(delivered_at) AS delivered FROM execution_deliveries WHERE connection_id=?').get(connectionId);