auto-updates: Do not poll for updates on dev channel (#13311)
Our dev builds don't have updates and will never have updates, so instead of polling our servers every time we start a dev instance, let's disable it for the dev channel. Release Notes: - N/A
This commit is contained in:
parent
f5f73efa8a
commit
c20a1ee032
2 changed files with 20 additions and 0 deletions
|
@ -141,8 +141,13 @@ pub fn init(http_client: Arc<HttpClientWithUrl>, cx: &mut AppContext) {
|
||||||
let auto_updater = cx.new_model(|cx| {
|
let auto_updater = cx.new_model(|cx| {
|
||||||
let updater = AutoUpdater::new(version, http_client);
|
let updater = AutoUpdater::new(version, http_client);
|
||||||
|
|
||||||
|
let poll_for_updates = ReleaseChannel::try_global(cx)
|
||||||
|
.map(|channel| channel.poll_for_updates())
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
if option_env!("ZED_UPDATE_EXPLANATION").is_none()
|
if option_env!("ZED_UPDATE_EXPLANATION").is_none()
|
||||||
&& env::var("ZED_UPDATE_EXPLANATION").is_err()
|
&& env::var("ZED_UPDATE_EXPLANATION").is_err()
|
||||||
|
&& poll_for_updates
|
||||||
{
|
{
|
||||||
let mut update_subscription = AutoUpdateSetting::get_global(cx)
|
let mut update_subscription = AutoUpdateSetting::get_global(cx)
|
||||||
.0
|
.0
|
||||||
|
@ -186,6 +191,13 @@ pub fn check(_: &Check, cx: &mut WindowContext) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !ReleaseChannel::try_global(cx)
|
||||||
|
.map(|channel| channel.poll_for_updates())
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(updater) = AutoUpdater::get(cx) {
|
if let Some(updater) = AutoUpdater::get(cx) {
|
||||||
updater.update(cx, |updater, cx| updater.poll(cx));
|
updater.update(cx, |updater, cx| updater.poll(cx));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -118,6 +118,14 @@ impl ReleaseChannel {
|
||||||
.map(|channel| channel.0)
|
.map(|channel| channel.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns whether we want to poll for updates for this [`ReleaseChannel`]
|
||||||
|
pub fn poll_for_updates(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
ReleaseChannel::Dev => false,
|
||||||
|
_ => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the display name for this [`ReleaseChannel`].
|
/// Returns the display name for this [`ReleaseChannel`].
|
||||||
pub fn display_name(&self) -> &'static str {
|
pub fn display_name(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue