format
This commit is contained in:
@@ -72,8 +72,16 @@ impl WorkerManager {
|
||||
// Read config for concurrency settings and spawn workers
|
||||
let cfg = state_clone.config.read().await.clone();
|
||||
spawn_worker(state_clone.clone(), WorkTaskType::Download, 1);
|
||||
spawn_worker(state_clone.clone(), WorkTaskType::Index, cfg.indexing.concurrency);
|
||||
spawn_worker(state_clone.clone(), WorkTaskType::Tag, cfg.tagging.concurrency);
|
||||
spawn_worker(
|
||||
state_clone.clone(),
|
||||
WorkTaskType::Index,
|
||||
cfg.indexing.concurrency,
|
||||
);
|
||||
spawn_worker(
|
||||
state_clone.clone(),
|
||||
WorkTaskType::Tag,
|
||||
cfg.tagging.concurrency,
|
||||
);
|
||||
spawn_worker(state_clone.clone(), WorkTaskType::Organize, 4);
|
||||
});
|
||||
}
|
||||
@@ -361,13 +369,13 @@ async fn process_index(
|
||||
break;
|
||||
}
|
||||
for track in &tracks {
|
||||
if let Some(ref mbid) = track.musicbrainz_id {
|
||||
if !wanted_mbids.contains(mbid.as_str()) {
|
||||
if let Some(ref mbid) = track.musicbrainz_id
|
||||
&& !wanted_mbids.contains(mbid.as_str())
|
||||
{
|
||||
let tag_payload = serde_json::json!({"track_id": track.id});
|
||||
downstream.push((WorkTaskType::Tag, tag_payload.to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
offset += 500;
|
||||
}
|
||||
} else if let Some(file_path) = payload.get("file_path").and_then(|v| v.as_str()) {
|
||||
@@ -420,8 +428,8 @@ async fn process_tag(
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
// Ensure a wanted_item exists for this track (marks imported files as Owned)
|
||||
if let Some(ref mbid) = track.musicbrainz_id {
|
||||
if queries::wanted::find_by_mbid(conn, mbid)
|
||||
if let Some(ref mbid) = track.musicbrainz_id
|
||||
&& queries::wanted::find_by_mbid(conn, mbid)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?
|
||||
.is_none()
|
||||
@@ -449,7 +457,6 @@ async fn process_tag(
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
// Create Organize work item
|
||||
let org_payload = serde_json::json!({"track_id": track_id});
|
||||
|
||||
Reference in New Issue
Block a user