fix(server/m7-352): log Finish/Fail run errors; drop unused seed-limit constant
This commit is contained in:
@@ -76,10 +76,7 @@ func stableSortByScoreThenHash(cands []rankedCandidate, dateStr string) {
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
systemMixLength = 25
|
||||
systemMixSeedLimit = 3
|
||||
)
|
||||
const systemMixLength = 25
|
||||
|
||||
// systemMixWeights are the fixed scoring weights used by the cron worker.
|
||||
// JitterMagnitude is 0 because daily determinism comes from tieBreakHash;
|
||||
@@ -126,17 +123,23 @@ func BuildSystemPlaylists(ctx context.Context, pool *pgxpool.Pool, logger *slog.
|
||||
var buildErr error
|
||||
defer func() {
|
||||
if buildErr == nil {
|
||||
_ = q.FinishSystemPlaylistRun(ctx, dbq.FinishSystemPlaylistRunParams{
|
||||
if err := q.FinishSystemPlaylistRun(ctx, dbq.FinishSystemPlaylistRunParams{
|
||||
UserID: userID,
|
||||
LastRunAt: pgtype.Timestamptz{Time: now.UTC(), Valid: true},
|
||||
LastRunDate: dateOnly,
|
||||
})
|
||||
}); err != nil {
|
||||
logger.Warn("system playlist: failed to mark run finished; in_flight may be stuck",
|
||||
"user_id", uuidStringPL(userID), "err", err)
|
||||
}
|
||||
} else {
|
||||
errStr := buildErr.Error()
|
||||
_ = q.FailSystemPlaylistRun(ctx, dbq.FailSystemPlaylistRunParams{
|
||||
if err := q.FailSystemPlaylistRun(ctx, dbq.FailSystemPlaylistRunParams{
|
||||
UserID: userID,
|
||||
LastError: &errStr,
|
||||
})
|
||||
}); err != nil {
|
||||
logger.Warn("system playlist: failed to record build failure",
|
||||
"user_id", uuidStringPL(userID), "err", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user