hammond-data: Index_loop does not wait for GET request to finish now.

This commit is contained in:
Jordan Petridis
2017-12-26 18:18:48 +02:00
parent 41abeeb2e3
commit bfb74c4dba
4 changed files with 43 additions and 80 deletions
+11 -13
View File
@@ -34,20 +34,18 @@ pub fn refresh_feed(content: Rc<Content>, source: Option<Vec<Source>>) {
}));
thread::spawn(move || {
let feeds = {
if let Some(vec) = source {
Ok(feed::fetch(vec))
} else {
feed::fetch_all()
}
if let Some(s) = source {
feed::index_loop(s);
} else {
let e = feed::index_all();
if let Err(err) = e {
error!("Error While trying to update the database.");
error!("Error msg: {}", err);
};
};
if let Ok(x) = feeds {
feed::index(x);
sender.send(true).expect("Couldn't send data to channel");;
glib::idle_add(refresh_podcasts_view);
};
sender.send(true).expect("Couldn't send data to channel");;
glib::idle_add(refresh_podcasts_view);
});
}
@@ -113,7 +111,7 @@ mod tests {
// Convert Source it into a Feed and index it
let feed = source.into_feed().unwrap();
index(vec![feed]);
index(&feed);
// Get the Podcast
let pd = dbqueries::get_podcast_from_source_id(sid).unwrap();