mirror of
https://github.com/n08i40k/schedule-parser-rusted.git
synced 2025-12-06 17:57:47 +03:00
refactor: refactor providers code
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::updater::Updater;
|
||||
pub use crate::updater::{UpdateSource, Updater};
|
||||
use async_trait::async_trait;
|
||||
use base::{ScheduleProvider, ScheduleSnapshot};
|
||||
use std::ops::DerefMut;
|
||||
@@ -8,8 +8,6 @@ use tokio::sync::RwLock;
|
||||
use tokio::time::interval;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
pub use crate::updater::UpdateSource;
|
||||
|
||||
mod parser;
|
||||
mod updater;
|
||||
mod xls_downloader;
|
||||
@@ -27,7 +25,7 @@ pub struct EngelsPolytechnicProvider {
|
||||
impl EngelsPolytechnicProvider {
|
||||
pub async fn get(
|
||||
update_source: UpdateSource,
|
||||
) -> Result<Arc<dyn ScheduleProvider>, crate::updater::error::Error> {
|
||||
) -> Result<Arc<dyn ScheduleProvider>, crate::updater::Error> {
|
||||
let (updater, snapshot) = Updater::new(update_source).await?;
|
||||
|
||||
Ok(Arc::new(Wrapper {
|
||||
@@ -65,7 +63,7 @@ impl ScheduleProvider for Wrapper {
|
||||
this.snapshot = Arc::new(snapshot);
|
||||
},
|
||||
|
||||
Err(updater::error::Error::QueryUrlFailed(updater::error::QueryUrlError::UriFetchFailed)) => {},
|
||||
Err(updater::Error::EmptyUri) => {},
|
||||
|
||||
Err(err) => {
|
||||
sentry::capture_error(&err);
|
||||
|
||||
Reference in New Issue
Block a user