improve scheduler
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-19 14:04:01 +11:00
parent e186644db7
commit a9e522cc84
2 changed files with 18 additions and 5 deletions

View File

@@ -169,7 +169,11 @@ func MigrateSnapshotRegistry(ctx context.Context, database db.Database) (Snapsho
}
if snapshotTime.IsZero() {
suffix := strings.TrimPrefix(table, "inventory_hourly_")
if parsed, parseErr := time.Parse("2006010215", suffix); parseErr == nil {
if parsed, parseErr := time.Parse("200601021504", suffix); parseErr == nil {
// Name encoded with date+hour+minute (e.g., 15-minute cadence)
snapshotTime = parsed
} else if parsed, parseErr := time.Parse("2006010215", suffix); parseErr == nil {
// Legacy hour-only encoding
snapshotTime = parsed
} else if epoch, parseErr := strconv.ParseInt(suffix, 10, 64); parseErr == nil {
snapshotTime = time.Unix(epoch, 0)