reduced the places where we probe hourly tables
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:
@@ -103,19 +103,9 @@ LIMIT ?
|
||||
continue
|
||||
}
|
||||
probed := false
|
||||
hasRows := count.Valid && count.Int64 > 0
|
||||
// If count is known and >0, trust it; if NULL, accept optimistically to avoid heavy probes.
|
||||
hasRows := !count.Valid || count.Int64 > 0
|
||||
start := time.Now()
|
||||
if !count.Valid {
|
||||
probed = true
|
||||
if ok, err := db.TableHasRows(ctx, dbConn, name); err == nil {
|
||||
hasRows = ok
|
||||
} else {
|
||||
hasRows = false
|
||||
if logger != nil {
|
||||
logger.Debug("snapshot table probe failed", "table", name, "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if vcenter != "" && hasRows {
|
||||
probed = true
|
||||
vrows, qerr := querySnapshotRows(ctx, dbConn, name, []string{"VmId"}, `"Vcenter" = ? LIMIT 1`, vcenter)
|
||||
|
||||
@@ -137,16 +137,10 @@ ORDER BY snapshot_time ASC
|
||||
if err := db.ValidateTableName(t.Table); err != nil {
|
||||
continue
|
||||
}
|
||||
if t.Count.Valid {
|
||||
if t.Count.Int64 <= 0 {
|
||||
// Trust snapshot_count if present; otherwise optimistically include to avoid long probes.
|
||||
if t.Count.Valid && t.Count.Int64 <= 0 {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
hasRows, err := db.TableHasRows(ctx, dbConn, t.Table)
|
||||
if err != nil || !hasRows {
|
||||
continue
|
||||
}
|
||||
}
|
||||
tables = append(tables, t)
|
||||
}
|
||||
return tables, nil
|
||||
|
||||
Reference in New Issue
Block a user