Comments (3)
Turns out to be a local network environment issue. Closed.
from godotenv.
Turns out to be a local network environment issue. Closed.
More specificly speaking, the DNS of raw.githubusercontent.com
is polluted and it will point to localhost
. By default the HttpClient.cs
uses IE proxy settings, but the proxy setting will bypass localhost. In that case, we have to declare the proxy explicitly when instanciating HttpClient's creation to solve this problem.
Now since the DNS Pollution is not my personal scienario but happens in the whole Mainland China, I think it's valuable to add proxy support for godotenv, hence reopening this issue.
from godotenv.
Now after adding the explicit proxy support, the WebRequestGetAsync()
function in NetworkClient
well looks like this:
public async Task<HttpResponseMessage> WebRequestGetAsync(string url, string? proxyUrl = null) {
var proxy = string.IsNullOrEmpty(proxyUrl) ? WebRequest.GetSystemWebProxy() : new WebProxy(proxyUrl);
var factory = new ServiceCollection()
.AddHttpClient(Options.DefaultName)
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { Proxy = proxy })
.Services
.BuildServiceProvider()
.GetService<IHttpClientFactory>();
var client = factory.CreateClient();
return await client.GetAsync(url);
}
Now we can see that there might be potential performance issue, since we cached the http client in the current version, but create a factory each time the function is executed. So what is the real situation?
I have used BenchmarkDotNet
to get the same 3 pages in 3 ways: no cache, cache the factory, cache the client, and the result looks like that:
Method | Mean | Error | StdDev |
---|---|---|---|
TestNoCache | 1,634.2 ms | 32.55 ms | 72.80 ms |
TestCacheFactory | 359.0 ms | 6.82 ms | 7.29 ms |
TestCacheClient | 351.5 ms | 6.10 ms | 5.41 ms |
Need to mention that this is the result of the second time, the first time I run this test, the mean time of TestCacheClient
goes to 600ms.
from godotenv.
Related Issues (20)
- Avoid spamming the elevation prompt on Windows
- Various first time install issues HOT 2
- Feature request: "install" Godot.app to the system-wide /Applications/ instead of user level ~/Applications/ HOT 1
- godotenv godot list gives NullReferenceException HOT 2
- Ability to version lock addons HOT 2
- Add Proxy settings for Downloader
- Failed to start a process with file path 'unzip' HOT 6
- MacOS version downloads Mono version instead of dotnet version HOT 2
- Add checksum verification for Godot downloads HOT 1
- Attempting to run git commands in ./addons when no .git directory exists HOT 3
- Checksum validation returns HTTP StatusCode 404 HOT 9
- Feature Request: addon install from zip URL
- feat: support more forgiving input version strings HOT 2
- Set GODOT environment variable in both ".bashrc" and ".bash_profile" shell configuration files on Unix
- VS Code gets confused by backslashes in $GODOT HOT 1
- `godotenv godot list` throws NullReferenceException HOT 10
- Failed to copy addon HOT 4
- Allow for "manual" or "override" addons HOT 3
- Feature Request: Add Windows on ARM Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godotenv.