feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -83,16 +83,17 @@ func ReconcileAutomaticDetectionSchedules(ctx context.Context, channels []model.
|
||||
}
|
||||
} else {
|
||||
var runs []model.DetectionRun
|
||||
if err := model.DB.WithContext(ctx).Select("id", "channel_id", "status", "quality", "settled", "finished_at").Where("channel_id IN ? AND user_id = 0 AND kind = ? AND (finished_at >= ? OR settled = ?)", ids, kind, cutoff, false).Find(&runs).Error; err != nil {
|
||||
if err := model.DB.WithContext(ctx).Select("id", "channel_id", "status", "quality", "settled", "finished_at", "kind", "error", "result").Where("channel_id IN ? AND user_id = 0 AND request_key NOT LIKE 'chain:%' AND kind = ? AND (finished_at >= ? OR settled = ?)", ids, kind, cutoff, false).Find(&runs).Error; err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
for _, run := range runs {
|
||||
run = NormalizeVisionRun(run)
|
||||
if !run.Settled {
|
||||
active[run.ChannelID] = true
|
||||
continue
|
||||
}
|
||||
outcome := "unknown"
|
||||
if run.Status == "succeeded" && (run.Quality == "normal" || run.Quality == "degraded") {
|
||||
if run.Status == "succeeded" && (run.Quality == "normal" || run.Quality == "degraded" || run.Quality == "incomplete") {
|
||||
outcome = run.Quality
|
||||
}
|
||||
results = append(results, automaticDetectionResult{run.ChannelID, run.ID, run.FinishedAt, outcome})
|
||||
@@ -115,12 +116,18 @@ func ReconcileAutomaticDetectionSchedules(ctx context.Context, channels []model.
|
||||
}
|
||||
seed.LastFinishedAt, seed.LastResultID = result.at, result.id
|
||||
seed.IntervalMinutes = 15
|
||||
if result.outcome == "normal" || result.outcome == "degraded" {
|
||||
if result.outcome == "normal" || result.outcome == "degraded" || result.outcome == "incomplete" {
|
||||
seed.LastValid = result.outcome
|
||||
seed.IntervalMinutes = 30
|
||||
}
|
||||
seed.NextDueAt = result.at + int64(seed.IntervalMinutes)*60
|
||||
}
|
||||
if kind == "ciallo" {
|
||||
seed.IntervalMinutes = 45
|
||||
if seed.LastFinishedAt > 0 {
|
||||
seed.NextDueAt = seed.LastFinishedAt + 45*60
|
||||
}
|
||||
}
|
||||
if err := model.EnsureDetectionSchedule(ctx, seed); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user