fix: replace-audio duration write now unconditional via SetDuration

UpdateDuration's null guard matched zero rows for tracks that already had a duration (all normally-uploaded tracks). Add SetDurationAsync/SetDuration/ITrackService.SetDuration with no null guard; fail on zero rows. ReplaceAudioAsync now calls SetDuration.
This commit is contained in:
daniel-c-harvey
2026-06-19 04:19:39 -04:00
parent 7265754c27
commit e8359d5473
4 changed files with 36 additions and 1 deletions
+1 -1
View File
@@ -217,7 +217,7 @@ public class UnifiedTrackService
// authoritative metadata update for the replace. A failure here is surfaced (unlike the
// best-effort waveform regen above) because a stale DurationSeconds silently corrupts
// derived aggregates (e.g. MixRuntimeSeconds on the home stats endpoint).
var durationWrite = await _sqlTrackService.UpdateDuration(trackId, newAudio.Duration, ct);
var durationWrite = await _sqlTrackService.SetDuration(trackId, newAudio.Duration, ct);
if (!durationWrite.Success)
{
var error = durationWrite.Messages.FirstOrDefault()?.Message ?? "Unknown error";