From 797a2c8a459f8aa48871383542a0fb26d8453e59 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 4 May 2026 09:14:40 -0400 Subject: [PATCH] fix(server/m7-352): log Finish/Fail run errors; drop unused seed-limit constant --- internal/playlists/system.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/internal/playlists/system.go b/internal/playlists/system.go index 30291c1f..4c43dc87 100644 --- a/internal/playlists/system.go +++ b/internal/playlists/system.go @@ -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) + } } }()