fix deletiontime from event
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1501,7 +1501,7 @@ SET
|
|||||||
END,
|
END,
|
||||||
"DeletionTime" = CASE
|
"DeletionTime" = CASE
|
||||||
WHEN t_last_after IS NOT NULL
|
WHEN t_last_after IS NOT NULL
|
||||||
AND (dst."DeletionTime" IS NULL OR dst."DeletionTime" = 0 OR t_last_after < dst."DeletionTime")
|
AND (dst."DeletionTime" IS NULL OR dst."DeletionTime" = 0)
|
||||||
THEN t_last_after
|
THEN t_last_after
|
||||||
ELSE dst."DeletionTime"
|
ELSE dst."DeletionTime"
|
||||||
END
|
END
|
||||||
@@ -1585,7 +1585,7 @@ SET
|
|||||||
(%[2]s."Name" IS NOT NULL AND t."Name" IS NOT NULL AND %[2]s."Name" = t."Name")
|
(%[2]s."Name" IS NOT NULL AND t."Name" IS NOT NULL AND %[2]s."Name" = t."Name")
|
||||||
)
|
)
|
||||||
AND t.first_after IS NOT NULL
|
AND t.first_after IS NOT NULL
|
||||||
AND ("DeletionTime" IS NULL OR "DeletionTime" = 0 OR t.first_after < "DeletionTime")
|
AND ("DeletionTime" IS NULL OR "DeletionTime" = 0)
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
),
|
),
|
||||||
"DeletionTime"
|
"DeletionTime"
|
||||||
|
|||||||
@@ -438,21 +438,27 @@ func (c *CronTask) applyInventoryDeletions(ctx context.Context, agg map[dailyAgg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k, v := range agg {
|
for k, v := range agg {
|
||||||
if v.deletion != 0 || k.Vcenter != vcenter {
|
if k.Vcenter != vcenter {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ts, ok := byID[k.VmId]; ok {
|
if ts, ok := byID[k.VmId]; ok {
|
||||||
v.deletion = ts
|
if v.deletion != ts {
|
||||||
|
v.deletion = ts
|
||||||
|
}
|
||||||
totalApplied++
|
totalApplied++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ts, ok := byUUID[k.VmUuid]; ok {
|
if ts, ok := byUUID[k.VmUuid]; ok {
|
||||||
v.deletion = ts
|
if v.deletion != ts {
|
||||||
|
v.deletion = ts
|
||||||
|
}
|
||||||
totalApplied++
|
totalApplied++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ts, ok := byName[strings.ToLower(k.Name)]; ok {
|
if ts, ok := byName[strings.ToLower(k.Name)]; ok {
|
||||||
v.deletion = ts
|
if v.deletion != ts {
|
||||||
|
v.deletion = ts
|
||||||
|
}
|
||||||
totalApplied++
|
totalApplied++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user