From cd937c484475207d6edea49c074767e76195b49b Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 14 Aug 2018 15:24:25 +0300 Subject: [PATCH] utils: Refactor refresh_feed Move channel creation inside the thread. Drop the Result return type as its not needed anymore. --- podcasts-gtk/src/utils.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/podcasts-gtk/src/utils.rs b/podcasts-gtk/src/utils.rs index a883e55..2089e91 100644 --- a/podcasts-gtk/src/utils.rs +++ b/podcasts-gtk/src/utils.rs @@ -201,21 +201,18 @@ where } refresh_feed(source, sender) - .map_err(|err| error!("Failed to update feeds: {}", err)) - .ok(); } /// Update the rss feed(s) originating from `source`. /// If `source` is None, Fetches all the `Source` entries in the database and updates them. -/// When It's done,it queues up a `RefreshViews` action. -fn refresh_feed(source: Option, sender: Sender) -> Result<(), Error> +fn refresh_feed(source: Option, sender: Sender) where S: IntoIterator + Send + 'static, { - let (up_sender, up_receiver) = bounded(1); - sender.send(Action::ShowUpdateNotif(up_receiver)); - rayon::spawn(move || { + let (up_sender, up_receiver) = bounded(1); + sender.send(Action::ShowUpdateNotif(up_receiver)); + if let Some(s) = source { // Refresh only specified feeds pipeline::run(s) @@ -233,7 +230,6 @@ where up_sender.send(true); }); - Ok(()) } lazy_static! {