You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -78,20 +80,36 @@ public static string? ImageServerUrl
78
80
if(_imageServerUrlis not null)
79
81
return_imageServerUrl;
80
82
81
-
// In case the server url is attempted to be accessed before the lazily initialized instance has been created, create it now if the service container is available.
82
-
varinstance=Instance;
83
-
if(instanceisnull)
84
-
returnnull;
85
-
86
-
try
87
-
{
88
-
varconfig=instance.UseClient(c =>c.GetAPIConfiguration(),"Get API configuration").Result;
// Lock before getting the config, in case multiple threads are trying to get the image server url at the same time.
84
+
lock(_imageServerUrlLockObj)
92
85
{
93
-
instance._logger.LogError(ex,"Encountered an exception while trying to find the image server url to use; {ErrorMessage}",ex.Message);
94
-
throw;
86
+
// Try one more time, in case it has been initialized while we were waiting.
87
+
if(_imageServerUrlis not null)
88
+
return_imageServerUrl;
89
+
90
+
// In case the server url is attempted to be accessed before the lazily initialized instance has been created, create it now if the service container is available, otherwise abort.
91
+
varinstance=Instance;
92
+
if(instanceisnull)
93
+
returnnull;
94
+
95
+
try
96
+
{
97
+
varconfig=instance.UseClient(c =>c.GetAPIConfiguration(),"Get API configuration").Result;
// If the API key is unavailable or if we can't establish a connection to the api server, then use the default image server url if we ever need to resolve the image URLs for whatever reason.
103
+
if(exisTmdbApiKeyUnavailableException||(exisHttpRequestExceptionhttpEx&&httpEx.HttpRequestErrorisHttpRequestError.NameResolutionError or HttpRequestError.ConnectionError or HttpRequestError.SecureConnectionError))
104
+
{
105
+
// If you can't be arsed to look it up yourself on their site, then here, waste more time than it's worth by decoding and reversing this string. No matter how you do it, it will be more effort compared to looking it up on their dev
106
+
// site. And while you're there, go get yourself a personal API key to use. ;)
0 commit comments