remove statichutao

This commit is contained in:
Lightczx
2023-09-22 17:31:00 +08:00
parent b5579aef6e
commit ef352303e7
3 changed files with 2 additions and 19 deletions

View File

@@ -30,9 +30,6 @@ internal sealed class ImageCache : IImageCache, IImageCacheFilePathOperation
[0] = TimeSpan.FromSeconds(4),
[1] = TimeSpan.FromSeconds(16),
[2] = TimeSpan.FromSeconds(64),
[3] = TimeSpan.FromSeconds(4),
[4] = TimeSpan.FromSeconds(16),
[5] = TimeSpan.FromSeconds(64),
};
private readonly ILogger logger;
@@ -173,7 +170,7 @@ internal sealed class ImageCache : IImageCache, IImageCacheFilePathOperation
int retryCount = 0;
HttpClient httpClient = httpClientFactory.CreateClient(nameof(ImageCache));
while (retryCount < 6)
while (retryCount < 3)
{
using (HttpResponseMessage message = await httpClient.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false))
{
@@ -191,10 +188,6 @@ internal sealed class ImageCache : IImageCache, IImageCacheFilePathOperation
switch (message.StatusCode)
{
case HttpStatusCode.NotFound:
// directly goto https://static.hut.ao
retryCount += 3;
break;
case HttpStatusCode.TooManyRequests:
{
retryCount++;
@@ -208,11 +201,6 @@ internal sealed class ImageCache : IImageCache, IImageCacheFilePathOperation
return;
}
}
if (retryCount == 3)
{
uri = new UriBuilder(uri) { Host = Web.HutaoEndpoints.StaticHutao }.Uri;
}
}
}

View File

@@ -113,7 +113,7 @@ internal static class StaticResource
ApplicationDataCompositeValue map = LocalSetting.Get(ContractMap, DefaultResourceVersionMap);
foreach ((string key, object value) in LatestResourceVersionMap)
{
if ((int)value > (int)map[key])
if (!map.TryGetValue(key, out object current) || (int)value > (int)current)
{
result.Add(key);
}

View File

@@ -13,11 +13,6 @@ namespace Snap.Hutao.Web;
[SuppressMessage("", "SA1124")]
internal static class HutaoEndpoints
{
/// <summary>
/// 胡桃资源主机名
/// </summary>
public const string StaticHutao = "static.hut.ao";
#region Hutao as a Service
public static string Announcement(string locale)
{