improve concurrency handling for inventory job
Some checks failed
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2026-01-21 11:21:51 +11:00
parent 715b293894
commit b77f8671da
4 changed files with 29 additions and 13 deletions

View File

@@ -137,9 +137,15 @@ ORDER BY snapshot_time ASC
if err := db.ValidateTableName(t.Table); err != nil {
continue
}
hasRows, err := db.TableHasRows(ctx, dbConn, t.Table)
if err != nil || !hasRows {
continue
if t.Count.Valid {
if t.Count.Int64 <= 0 {
continue
}
} else {
hasRows, err := db.TableHasRows(ctx, dbConn, t.Table)
if err != nil || !hasRows {
continue
}
}
tables = append(tables, t)
}