optimize_max_age_for_startup

Function optimize_max_age_for_startup 

Source
pub fn optimize_max_age_for_startup(
    last_startup: Option<&str>,
    default_max_age: Option<u32>,
) -> Option<u32>
Expand description

What: Calculate optimal max_age_days based on last startup timestamp.

Inputs:

  • last_startup: Optional timestamp in YYYYMMDD:HHMMSS format.
  • default_max_age: Default max age in days if no optimization applies.

Output:

  • Optimized max_age_days value, or None to fetch all.

Details:

  • If last startup was within 1 hour: use 1 day (recent data likely cached)
  • If last startup was within 24 hours: use 2 days
  • If last startup was within 7 days: use configured max_age or 7 days
  • Otherwise: use configured max_age
  • This reduces unnecessary fetching when the app was recently used.
  • NOTE: This only affects Arch news and advisories date filtering. Package updates are ALWAYS fetched fresh to detect new packages and version changes.