Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ pub async fn run(
config: app_config::Config,
handle: tokio::runtime::Handle,
) -> Result<(), std::io::Error> {
// Fire-and-forget: errors are logged inside check_for_updates().
tokio::spawn(crate::updates::check_for_updates());

// Spawn the cache if it doesn't exist.
tokio::fs::create_dir_all(&config.cache.path).await?;

Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ fn main() {
std::process::exit(1);
});

updates::check_for_updates();

let args = Args::parse();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium

Removing the synchronous updates::check_for_updates() call means only the daemon startup path will ever trigger an update warning. Commands such as git-fs reload (which talk to an already-running daemon but do not start it) used to surface the warning on every invocation, but now they will never emit it. If that isn’t intentional, we may need to keep a non-blocking check (or a stub that notifies the daemon) for those management commands as well.

Fix in Cursor • Fix in Claude

Prompt for Agent
Task: Address review feedback left on GitHub.
Repository: mesa-dot-dev/gitfs#34
File: src/main.rs#L61
Action: Open this file location in your editor, inspect the highlighted code, and resolve the issue described below.

Feedback:
Removing the synchronous `updates::check_for_updates()` call means only the daemon startup path will ever trigger an update warning. Commands such as `git-fs reload` (which talk to an already-running daemon but do not start it) used to surface the warning on every invocation, but now they will never emit it. If that isn’t intentional, we may need to keep a non-blocking check (or a stub that notifies the daemon) for those management commands as well.

let config = Config::load_or_create(args.config_path.as_deref()).unwrap_or_else(|e| {
error!("Failed to load configuration: {e}");
Expand Down
28 changes: 15 additions & 13 deletions src/updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@ const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
/// Check GitHub for the latest stable release and warn if this binary is outdated.
///
/// This function never fails the application — it logs errors and returns.
pub fn check_for_updates() {
pub async fn check_for_updates() {
let short_sha = &BUILD_SHA[..7.min(BUILD_SHA.len())];
let running_version = format!("{PKG_VERSION}+{short_sha}");

let releases = match self_update::backends::github::ReleaseList::configure()
.repo_owner("mesa-dot-dev")
.repo_name("git-fs")
.build()
let releases = match tokio::task::spawn_blocking(|| {
self_update::backends::github::ReleaseList::configure()
.repo_owner("mesa-dot-dev")
.repo_name("git-fs")
.build()
.and_then(self_update::backends::github::ReleaseList::fetch)
})
.await
{
Ok(list) => match list.fetch() {
Ok(releases) => releases,
Err(e) => {
error!("Could not check for updates: {e}");
return;
}
},
Ok(Ok(releases)) => releases,
Ok(Err(e)) => {
error!("Could not check for updates: {e}");
return;
}
Err(e) => {
error!("Could not configure update check: {e}");
error!("Update check task failed: {e}");
return;
}
};
Expand Down