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 (
|
const systemMixLength = 25
|
||||||
systemMixLength = 25
|
|
||||||
systemMixSeedLimit = 3
|
|
||||||
)
|
|
||||||
|
|
||||||
// systemMixWeights are the fixed scoring weights used by the cron worker.
|
// systemMixWeights are the fixed scoring weights used by the cron worker.
|
||||||
// JitterMagnitude is 0 because daily determinism comes from tieBreakHash;
|
// 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
|
var buildErr error
|
||||||
defer func() {
|
defer func() {
|
||||||
if buildErr == nil {
|
if buildErr == nil {
|
||||||
_ = q.FinishSystemPlaylistRun(ctx, dbq.FinishSystemPlaylistRunParams{
|
if err := q.FinishSystemPlaylistRun(ctx, dbq.FinishSystemPlaylistRunParams{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
LastRunAt: pgtype.Timestamptz{Time: now.UTC(), Valid: true},
|
LastRunAt: pgtype.Timestamptz{Time: now.UTC(), Valid: true},
|
||||||
LastRunDate: dateOnly,
|
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 {
|
} else {
|
||||||
errStr := buildErr.Error()
|
errStr := buildErr.Error()
|
||||||
_ = q.FailSystemPlaylistRun(ctx, dbq.FailSystemPlaylistRunParams{
|
if err := q.FailSystemPlaylistRun(ctx, dbq.FailSystemPlaylistRunParams{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
LastError: &errStr,
|
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