Rename refresh to schedule_refresh

This commit is contained in:
Timofey 2020-01-08 22:40:58 +03:00 committed by Jordan Petridis
parent 1175a54266
commit 685b35cb23
3 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ use podcasts_data::{dbqueries, Source};
use crate::app::Action; use crate::app::Action;
use crate::stacks::Content; use crate::stacks::Content;
use crate::utils::{itunes_to_rss, refresh}; use crate::utils::{itunes_to_rss, schedule_refresh};
use std::rc::Rc; use std::rc::Rc;
@ -85,7 +85,7 @@ impl AddPopover {
rayon::spawn(clone!(sender => move || { rayon::spawn(clone!(sender => move || {
if let Ok(source) = Source::from_url(&url) { if let Ok(source) = Source::from_url(&url) {
refresh(Some(vec![source]), sender.clone()); schedule_refresh(Some(vec![source]), sender.clone());
} else { } else {
error!("Failed to convert, url: {}, to a source entry", url); error!("Failed to convert, url: {}, to a source entry", url);
} }

View File

@ -206,7 +206,7 @@ pub(crate) fn cleanup(cleanup_date: DateTime<Utc>) {
/// Schedule feed refresh /// Schedule feed refresh
/// If `source` is None, Refreshes all sources in the database. /// If `source` is None, Refreshes all sources in the database.
/// Current implementation ignores update request if another update is already running /// Current implementation ignores update request if another update is already running
pub(crate) fn refresh(source: Option<Vec<Source>>, sender: Sender<Action>) { pub(crate) fn schedule_refresh(source: Option<Vec<Source>>, sender: Sender<Action>) {
// If we try to update the whole db, // If we try to update the whole db,
// Exit early if `source` table is empty // Exit early if `source` table is empty
if source.is_none() { if source.is_none() {
@ -228,7 +228,7 @@ pub(crate) fn refresh(source: Option<Vec<Source>>, sender: Sender<Action>) {
/// Update the rss feed(s) originating from `source`. /// Update the rss feed(s) originating from `source`.
/// If `source` is None, Fetches all the `Source` entries in the database and updates them. /// If `source` is None, Fetches all the `Source` entries in the database and updates them.
/// Do not call this function directly unless you are sure no other updates are running. /// Do not call this function directly unless you are sure no other updates are running.
/// Use `refresh()` instead /// Use `schedule_refresh()` instead
pub(crate) fn refresh_feed(source: Option<Vec<Source>>, sender: Sender<Action>) { pub(crate) fn refresh_feed(source: Option<Vec<Source>>, sender: Sender<Action>) {
rayon::spawn(move || { rayon::spawn(move || {
let (up_sender, up_receiver) = bounded(1); let (up_sender, up_receiver) = bounded(1);
@ -421,7 +421,7 @@ pub(crate) fn on_import_clicked(window: &gtk::ApplicationWindow, sender: &Sender
// Parse the file and import the feeds // Parse the file and import the feeds
if let Ok(sources) = opml::import_from_file(filename) { if let Ok(sources) = opml::import_from_file(filename) {
// Refresh the successfully parsed feeds to index them // Refresh the successfully parsed feeds to index them
refresh(Some(sources), sender) schedule_refresh(Some(sources), sender)
} else { } else {
let text = i18n("Failed to parse the imported file"); let text = i18n("Failed to parse the imported file");
sender.send(Action::ErrorNotification(text)).expect("Action channel blew up somehow"); sender.send(Action::ErrorNotification(text)).expect("Action channel blew up somehow");

View File

@ -138,7 +138,7 @@ impl MainWindow {
if settings.get_boolean("refresh-on-startup") { if settings.get_boolean("refresh-on-startup") {
info!("Refresh on startup."); info!("Refresh on startup.");
let s: Option<Vec<_>> = None; let s: Option<Vec<_>> = None;
utils::refresh(s, sender.clone()); utils::schedule_refresh(s, sender.clone());
} }
let refresh_interval = settings::get_refresh_interval(&settings).num_seconds() as u32; let refresh_interval = settings::get_refresh_interval(&settings).num_seconds() as u32;
@ -147,7 +147,7 @@ impl MainWindow {
let r_sender = sender.clone(); let r_sender = sender.clone();
gtk::timeout_add_seconds(refresh_interval, move || { gtk::timeout_add_seconds(refresh_interval, move || {
let s: Option<Vec<_>> = None; let s: Option<Vec<_>> = None;
utils::refresh(s, r_sender.clone()); utils::schedule_refresh(s, r_sender.clone());
glib::Continue(true) glib::Continue(true)
}); });
@ -180,7 +180,7 @@ impl MainWindow {
action(&self.window, "refresh", clone!(sender => move |_, _| { action(&self.window, "refresh", clone!(sender => move |_, _| {
gtk::idle_add(clone!(sender => move || { gtk::idle_add(clone!(sender => move || {
let s: Option<Vec<_>> = None; let s: Option<Vec<_>> = None;
utils::refresh(s, sender.clone()); utils::schedule_refresh(s, sender.clone());
glib::Continue(false) glib::Continue(false)
})); }));
})); }));