Skip to content

Commit

Permalink
fixed unintutive strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Jan 24, 2024
1 parent 4ac6ceb commit d9c44a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/main-api/src/calendar/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ impl StrategyExecutor {
) -> Result<CalendarEntries, HttpResponse> {
let intial = match last_calendar_scrape_at {
Some(l) => {
if Self::one_hour_ago() < *l {
self.exec::<APIRequestor>(last_calendar_scrape_at).await
} else {
if *l > Self::one_hour_ago() {
self.exec::<DbRequestor>(last_calendar_scrape_at).await
} else {
self.exec::<APIRequestor>(last_calendar_scrape_at).await
}
}
None => self.exec::<APIRequestor>(last_calendar_scrape_at).await,
Expand All @@ -75,7 +75,7 @@ impl StrategyExecutor {
Err(e) => {
error!("could not fetch due to {e:?}");
let last_scrape = last_calendar_scrape_at.unwrap_or_default();
if Self::three_days_ago() < last_scrape {
if last_scrape < Self::three_days_ago() {
match self.exec::<DbRequestor>(last_calendar_scrape_at).await {
Ok(res) => Ok(res),
Err(e) => {
Expand Down

0 comments on commit d9c44a5

Please sign in to comment.