Debounce language server reinstall attempts (#8277)

I don't think there's value in retrying 4 times as fast as possible,
especially if we might hit the Github API every time to check for the
newest version.

That gets us in rate limit problems quickly.

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-02-23 17:00:05 +01:00 committed by GitHub
parent 351c8c9a36
commit 6d91224882
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,6 +100,7 @@ pub use task_inventory::Inventory;
pub use worktree::*;
const MAX_SERVER_REINSTALL_ATTEMPT_COUNT: u64 = 4;
const SERVER_REINSTALL_DEBOUNCE_TIMEOUT: Duration = Duration::from_secs(1);
const SERVER_LAUNCHING_BEFORE_SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5);
pub trait Item {
@ -2877,6 +2878,14 @@ impl Project {
return None;
}
log::info!(
"retrying installation of language server {server_name:?} in {}s",
SERVER_REINSTALL_DEBOUNCE_TIMEOUT.as_secs()
);
cx.background_executor()
.timer(SERVER_REINSTALL_DEBOUNCE_TIMEOUT)
.await;
let installation_test_binary = adapter
.installation_test_binary(container_dir.to_path_buf())
.await;