fix(offline_cache): use Queued for reset_track_for_redownload, drop redundant Pending

The previous commit added a Pending variant to OfflineCacheStatus, but
the existing Queued variant already represents 'freshly inserted,
awaiting downloader pickup' (insert_track writes status='queued').
Reusing Queued keeps reset_track_for_redownload semantically aligned
with insert_track and preserves the in-flight count SQL that already
matches WHERE status='downloading' OR status='queued'.

cc
This commit is contained in:
vicrodh committed 2026-05-06 07:24:50 -06:00
1 parent c47a5558ad
commit 60daa7e1c6
2 files changed
+2 -5

No files matched your search

+2 -2
View File
@@ -381,7 +381,7 @@ impl OfflineCacheDb {
self.conn()
.execute(
"UPDATE cached_tracks
SET status = 'pending', progress_percent = 0, error_message = NULL
SET status = 'queued', progress_percent = 0, error_message = NULL
WHERE track_id = ?1",
[track_id as i64],
)
@@ -743,7 +743,7 @@ mod maintenance_tests {
db.reset_track_for_redownload(1).unwrap();
let track = db.get_track(1).unwrap().unwrap();
assert!(matches!(track.status, OfflineCacheStatus::Pending));
assert!(matches!(track.status, OfflineCacheStatus::Queued));
assert_eq!(track.progress_percent, 0);
assert!(track.error_message.is_none());
}
-3
View File
@@ -34,7 +34,6 @@ pub use path_validator::{is_offline_root_available, validate_path, PathStatus};
#[serde(rename_all = "lowercase")]
pub enum OfflineCacheStatus {
Queued,
Pending,
Downloading,
Ready,
Failed,
@@ -44,7 +43,6 @@ impl OfflineCacheStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::Queued => "queued",
Self::Pending => "pending",
Self::Downloading => "downloading",
Self::Ready => "ready",
Self::Failed => "failed",
@@ -54,7 +52,6 @@ impl OfflineCacheStatus {
pub fn from_str(s: &str) -> Self {
match s {
"queued" => Self::Queued,
"pending" => Self::Pending,
"downloading" => Self::Downloading,
"ready" => Self::Ready,
"failed" => Self::Failed,