|
|
@@ -108,18 +108,34 @@ pub fn download_and_save_feeds( |
|
|
|
} |
|
|
|
|
|
|
|
if let Some(receiver) = receiver { |
|
|
|
match receiver.try_recv() { |
|
|
|
let instruction = match receiver.try_recv() { |
|
|
|
Ok(value) => { |
|
|
|
println!( |
|
|
|
"[DL] Received instruction {:?} while downloading, ignoring it.", |
|
|
|
value, |
|
|
|
); |
|
|
|
println!("[DL] Received instruction {:?} while downloading.", value,); |
|
|
|
Some(value) |
|
|
|
} |
|
|
|
Err(err) => { |
|
|
|
if err != mpsc::TryRecvError::Empty { |
|
|
|
println!("[DL] Error attempting to receive from channel: {}", err); |
|
|
|
break; |
|
|
|
} |
|
|
|
None |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
if let Some(instruction) = instruction { |
|
|
|
// If we receive the force download all instruction and we're not already force downloading |
|
|
|
// run this same function with force download all enabled. |
|
|
|
if instruction == DownloaderInstruction::ForceDownloadAll |
|
|
|
&& !force_download |
|
|
|
{ |
|
|
|
println!( |
|
|
|
"[DL] Restarting the downloader with force download enabled." |
|
|
|
); |
|
|
|
download_and_save_feeds(&conn, true, false, Some(&receiver)).unwrap(); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
// Otherwise just print that we're ignoring the instruction. |
|
|
|
println!("[DL] Ignoring the {:?} instruction.", instruction); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|