Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proxy settings retrieval on startup #18171

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

ClanEver
Copy link
Contributor

Closes #18155

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 20, 2024
@zed-industries-bot
Copy link

Messages
📖

This PR includes links to the following GitHub Issues: #18155
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against 8e8396c

@SomeoneToIgnore
Copy link
Contributor

@JunkuiZhang , would you want to have a peek at this?

@JunkuiZhang
Copy link
Contributor

@SomeoneToIgnore I’ve been extremely busy lately. I’m currently participating in a competition with tight deadlines and heavy workloads, leaving me with almost no rest. If it’s okay, the competition will be over in about two days, and I’ll have much more time to focus on this.

From my perspective, this PR needs more detailed description. At the very least, it should explain the root cause of the original issue and why this PR resolves it. This would make the review process smoother and quicker, and also increase the chances of your PR being merged.

From a quick look, it seems like handle_settings_file_changes just displays a notification window when the settings file encounters an error. I’m not sure why moving the call to this function before client::init_settings(cx); would fix the issue.

Additionally, I’m curious about how this change might affect #15446.

@SomeoneToIgnore
Copy link
Contributor

Sorry, I was unaware of this, it's totally ok to ignore my message entirely if needed.
Thank you for a quick review.

@ClanEver
Copy link
Contributor Author

I apologize for not explaining this PR, which wasted some of your time.

I've reviewed #15446.

It appears that all HTTP requests use the HTTP client created here: let http = IsahcHttpClient::new(proxy_url, Some(user_agent));.

Before:

  1. let proxy_str = ProxySettings::get_global(cx).proxy.to_owned(); reads the proxy settings from the global SettingsStore.
  2. handle_settings_file_changes(user_settings_file_rx, cx, handle_settings_changed); reads settings from the file into the global SettingsStore, including the proxy.

So before the modification, the proxy settings from the settings file were ignored, causing proxy_str to always be None.

After:
By reading the settings from the file first, then let proxy_str = ProxySettings::get_global(cx).proxy.to_owned(); becomes correct.


I just tested that simply placing handle_settings_file_changes(user_settings_file_rx, cx, handle_settings_changed); before let proxy_str = ProxySettings::get_global(cx).proxy.to_owned(); works. When submitting the PR, I referred to the order before the changes in #15446, thinking it needed to be placed before client::init_settings(cx); to work.

@JunkuiZhang
Copy link
Contributor

Sorry, I was unaware of this, it's totally ok to ignore my message entirely if needed. Thank you for a quick review.

@SomeoneToIgnore There's no need to be sorry, my friend. I can still read and reply emails and github notifications everyday.

@ConradIrwin ConradIrwin merged commit fd07fef into zed-industries:main Sep 24, 2024
9 checks passed
@ConradIrwin
Copy link
Member

Thanks for this!

@ClanEver ClanEver deleted the fix-client-setting-init branch September 25, 2024 08:59
noaccOS pushed a commit to noaccOS/zed that referenced this pull request Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can not connection network through my proxy after #15446
5 participants