refactor: refactor providers code

This commit is contained in:
2025-10-02 07:55:07 +04:00
parent df74ab03a1
commit f121a04f1b
10 changed files with 206 additions and 237 deletions

View File

@@ -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);