refresh_feed: remove code duplication.

This commit is contained in:
Jordan Petridis 2018-01-26 19:29:45 +02:00
parent 5e1d1e557f
commit 8c0e3221cb
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -21,20 +21,12 @@ pub fn refresh_feed(source: Option<Vec<Source>>, sender: Sender<Action>) {
sender.send(Action::HeaderBarShowUpdateIndicator).unwrap();
thread::spawn(move || {
// FIXME: This is messy at best.
if let Some(s) = source {
// TODO: determine if it needs to ignore_etags.
if let Err(err) = pipeline::run(s, true) {
error!("Error While trying to update the database.");
error!("Error msg: {}", err);
}
} else {
let sources = dbqueries::get_sources().unwrap();
let sources = source.unwrap_or_else(|| dbqueries::get_sources().unwrap());
if let Err(err) = pipeline::run(sources, false) {
error!("Error While trying to update the database.");
error!("Error msg: {}", err);
}
};
sender.send(Action::HeaderBarHideUpdateIndicator).unwrap();
sender.send(Action::RefreshAllViews).unwrap();