diff --git a/podcasts-data/src/errors.rs b/podcasts-data/src/errors.rs index 1f34a8d..a75055f 100644 --- a/podcasts-data/src/errors.rs +++ b/podcasts-data/src/errors.rs @@ -65,6 +65,8 @@ pub enum DataError { HttpStatusGeneral(HttpStatusError), #[fail(display = "Source redirects to a new url")] FeedRedirect(Source), + #[fail(display = "Feed is up to date")] + FeedNotModified(Source), #[fail( display = "Error occured while Parsing an Episode. Reason: {}", reason diff --git a/podcasts-data/src/models/source.rs b/podcasts-data/src/models/source.rs index 672dc5e..9842ce4 100644 --- a/podcasts-data/src/models/source.rs +++ b/podcasts-data/src/models/source.rs @@ -144,7 +144,10 @@ impl Source { }; match code { - StatusCode::NotModified => return Err(self.make_err("304: skipping..", code)), + StatusCode::NotModified => { + info!("304: Source, (id: {}), is up to date", self.id()); + return Err(DataError::FeedNotModified(self)); + } StatusCode::MovedPermanently | StatusCode::Found | StatusCode::PermanentRedirect => { warn!("Feed was moved permanently."); self = self.update_url(&res)?; diff --git a/podcasts-data/src/pipeline.rs b/podcasts-data/src/pipeline.rs index f3202c8..6f2ab34 100644 --- a/podcasts-data/src/pipeline.rs +++ b/podcasts-data/src/pipeline.rs @@ -38,8 +38,13 @@ where }) // the stream will stop at the first error so // we ensure that everything will succeded regardless. - .map_err(|err| error!("Error: {}", err)) - .then(|_| ok::<(), DataError>(())) + .map_err(|err| { + match err { + // Avoid spamming the stderr when its not an eactual error + DataError::FeedNotModified(_) => (), + _ => error!("Error: {}", err), + } + }).then(|_| ok::<(), DataError>(())) .collect() }