still working on creation/deletion times
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-28 15:19:10 +11:00
parent 49484900ac
commit ff783fb45a
3 changed files with 37 additions and 6 deletions

View File

@@ -532,8 +532,10 @@ WHERE "Vcenter" = ? AND "DeletedAt" IS NOT NULL AND "DeletedAt" > 0 AND "Deleted
missed++
continue
}
target.deletion = deletedAt.Int64
applied++
if target.deletion == 0 || deletedAt.Int64 < target.deletion {
target.deletion = deletedAt.Int64
applied++
}
}
rows.Close()
if err := rows.Err(); err != nil {

View File

@@ -1134,7 +1134,7 @@ func (c *CronTask) captureHourlySnapshotForVcenter(ctx context.Context, startTim
}); err != nil {
log.Warn("failed to update inventory deletion time from event", "vm_id", cand.vmID, "vm_uuid", cand.vmUUID, "vcenter", url, "error", err)
}
if err := db.MarkVmDeletedWithDetails(ctx, dbConn, url, cand.vmID, cand.vmUUID, cand.name, cand.cluster, t.Unix()); err != nil {
if err := db.MarkVmDeletedFromEvent(ctx, dbConn, url, cand.vmID, cand.vmUUID, cand.name, cand.cluster, t.Unix()); err != nil {
log.Warn("failed to refine lifecycle cache deletion time", "vm_id", cand.vmID, "vm_uuid", cand.vmUUID, "vcenter", url, "error", err)
}
if snapRow, snapTable, found := findVMInHourlySnapshots(ctx, dbConn, url, cand.vmID); found {
@@ -1276,7 +1276,7 @@ func (c *CronTask) captureHourlySnapshotForVcenter(ctx context.Context, startTim
if inv.Cluster.Valid {
clusterName = inv.Cluster.String
}
if err := db.MarkVmDeletedWithDetails(ctx, dbConn, url, vmID, inv.VmUuid.String, inv.Name, clusterName, t.Unix()); err != nil {
if err := db.MarkVmDeletedFromEvent(ctx, dbConn, url, vmID, inv.VmUuid.String, inv.Name, clusterName, t.Unix()); err != nil {
c.Logger.Warn("count-drop: failed to refine lifecycle cache deletion time", "vm_id", vmID, "vm_uuid", inv.VmUuid, "vcenter", url, "error", err)
}
tableToUpdate := snapTable