From d52a9cb61531dc6fe648cf0f76574d044cac21fd Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:32:08 +0100 Subject: [PATCH] fix: re-add updates check caching --- CHANGELOG.md | 4 ++++ src/cli/version.rs | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0d5ea1..4c87875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed +- Add back mistakenly removed updates check caching by @daimond113 + ## [0.5.0-rc.10] - 2024-11-16 ### Fixed - Fix `self-install` doing a cross-device move by @daimond113 diff --git a/src/cli/version.rs b/src/cli/version.rs index a4a4d9a..858fc9f 100644 --- a/src/cli/version.rs +++ b/src/cli/version.rs @@ -1,4 +1,9 @@ -use crate::cli::{bin_dir, config::read_config, files::make_executable, home_dir}; +use crate::cli::{ + bin_dir, + config::{read_config, write_config, CliConfig}, + files::make_executable, + home_dir, +}; use anyhow::Context; use colored::Colorize; use fs_err::tokio as fs; @@ -70,7 +75,15 @@ pub async fn check_for_updates(reqwest: &reqwest::Client) -> anyhow::Result<()> { version } else { - get_latest_remote_version(reqwest).await? + let version = get_latest_remote_version(reqwest).await?; + + write_config(&CliConfig { + last_checked_updates: Some((chrono::Utc::now(), version.clone())), + ..config + }) + .await?; + + version }; let current_version = current_version();