Files
deepdrft/DeepDrftManager/Components/Pages/Tracks/BatchRowModel.cs
T
daniel-c-harvey c9c6286571 Fix large CMS upload timeout with idle heartbeat and add per-file progress meter
Replace the 100s default HttpClient timeout (set Timeout=Infinite) with an idle/heartbeat
deadline driven by a ProgressStreamContent wrapper that reports bytes-on-the-wire. Each tick
resets the idle window and advances a MudProgressLinear per upload row. Idle window is
configurable via Upload:IdleTimeoutSeconds (default 90s).
2026-06-17 11:07:19 -04:00

44 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Microsoft.AspNetCore.Components.Forms;
namespace DeepDrftManager.Components.Pages.Tracks;
/// <summary>
/// A single track row shared by <c>BatchUpload</c> (all rows are new uploads) and
/// <c>BatchEdit</c> (existing rows carry <see cref="Id"/>; admins may also add new upload rows).
/// </summary>
public class BatchRowModel
{
/// <summary>SQL id of an existing track. <c>null</c> means a new row to upload.</summary>
public long? Id { get; set; }
/// <summary>Vault entry key — existing rows only.</summary>
public string? EntryKey { get; set; }
/// <summary>Original upload filename — existing rows only, read-only display.</summary>
public string? OriginalFileName { get; set; }
/// <summary>Selected WAV — new rows only.</summary>
public IBrowserFile? WavFile { get; set; }
public string TrackName { get; set; } = string.Empty;
public int TrackNumber { get; set; }
public BatchRowStatus Status { get; set; } = BatchRowStatus.Queued;
public string? ErrorMessage { get; set; }
/// <summary>Bytes pushed to the wire so far for this row's in-flight upload. Reset per attempt.</summary>
public long UploadedBytes { get; set; }
/// <summary>Total payload bytes for this row (the WAV file size), the progress denominator.</summary>
public long TotalBytes { get; set; }
/// <summary>Upload completion as a 0100 percent, or 0 when the total is unknown.</summary>
public int UploadPercent => TotalBytes > 0
? (int)Math.Clamp(UploadedBytes * 100 / TotalBytes, 0, 100)
: 0;
}
public enum BatchRowStatus { Queued, Uploading, Done, Failed }