File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1+ using System . Collections . Concurrent ;
12using System . Text ;
23using System . Text . RegularExpressions ;
34using ImageSharpCommunity . Providers . Remote . Configuration ;
@@ -10,7 +11,7 @@ namespace ImageSharpCommunity.Providers.Remote;
1011
1112public static class Helpers
1213{
13- private static Dictionary < string , HttpClient > HttpClients { get ; } = new Dictionary < string , HttpClient > ( ) ;
14+ private static ConcurrentDictionary < string , HttpClient > HttpClients { get ; } = new ConcurrentDictionary < string , HttpClient > ( ) ;
1415
1516 /// <summary>
1617 /// Gets the remote URL for a given path, based on the specified options.
@@ -35,7 +36,7 @@ public static HttpClient GetRemoteImageProviderHttpClient(this IHttpClientFactor
3536 httpClient . Timeout = TimeSpan . FromMilliseconds ( setting . Timeout ) ;
3637 httpClient . MaxResponseContentBufferSize = setting . MaxBytes ;
3738
38- HttpClients . TryAdd ( setting . ClientDictionaryKey , httpClient ) ;
39+ HttpClients . AddOrUpdate ( setting . ClientDictionaryKey , httpClient , ( _ , _ ) => httpClient ) ;
3940
4041 return httpClient ;
4142 }
You can’t perform that action at this time.
0 commit comments