Skip to content

Commit 4d0cf32

Browse files
authored
fix: drop blocking call to check updates (#3160)
1 parent d845f4a commit 4d0cf32

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/cli/tc/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub async fn run() -> Result<()> {
1616
tracing::info!("Env file: {:?} loaded", path);
1717
}
1818
let cli = Cli::parse();
19-
update_checker::check_for_update().await;
19+
tokio::task::spawn(update_checker::check_for_update());
2020
// Initialize ping event every 60 seconds
2121
let _ = TRACKER
2222
.init_ping(tokio::time::Duration::from_secs(60))

src/cli/update_checker.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,20 @@ fn show_update_message(name: &str, latest_version: Version) {
7575
}
7676

7777
pub async fn check_for_update() {
78-
tokio::task::spawn_blocking(|| {
79-
if VERSION.is_dev() {
80-
// skip validation if it's not a release
81-
return;
82-
}
78+
if VERSION.is_dev() {
79+
// skip validation if it's not a release
80+
return;
81+
}
8382

84-
let name: &str = "tailcallhq/tailcall";
83+
let name: &str = "tailcallhq/tailcall";
8584

86-
let informer = update_informer::new(registry::GitHub, name, VERSION.as_str());
85+
let informer = update_informer::new(registry::GitHub, name, VERSION.as_str());
8786

88-
if let Some(latest_version) = informer.check_version().ok().flatten() {
89-
// schedules the update message to be shown when the user presses Ctrl+C on cli.
90-
let _ = set_handler(move || {
91-
show_update_message(name, latest_version.clone());
92-
std::process::exit(exitcode::OK);
93-
});
94-
}
95-
});
87+
if let Some(latest_version) = informer.check_version().ok().flatten() {
88+
// schedules the update message to be shown when the user presses Ctrl+C on cli.
89+
let _ = set_handler(move || {
90+
show_update_message(name, latest_version.clone());
91+
std::process::exit(exitcode::OK);
92+
});
93+
}
9694
}

0 commit comments

Comments
 (0)