feat: upgrade to .NET 6, refactor everything

This commit is contained in:
spiral
2021-11-26 21:10:56 -05:00
parent d28e99ba43
commit 1918c56937
314 changed files with 27954 additions and 27966 deletions

View File

@@ -1,41 +1,30 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Serilog;
namespace Myriad.Gateway.Limit
namespace Myriad.Gateway.Limit;
public class TwilightGatewayRatelimiter: IGatewayRatelimiter
{
public class TwilightGatewayRatelimiter: IGatewayRatelimiter
private readonly HttpClient _httpClient = new() { Timeout = TimeSpan.FromSeconds(60) };
private readonly ILogger _logger;
private readonly string _url;
public TwilightGatewayRatelimiter(ILogger logger, string url)
{
private readonly string _url;
private readonly ILogger _logger;
private readonly HttpClient _httpClient = new()
{
Timeout = TimeSpan.FromSeconds(60)
};
_url = url;
_logger = logger.ForContext<TwilightGatewayRatelimiter>();
}
public TwilightGatewayRatelimiter(ILogger logger, string url)
{
_url = url;
_logger = logger.ForContext<TwilightGatewayRatelimiter>();
}
public async Task Identify(int shard)
{
while (true)
public async Task Identify(int shard)
{
while (true)
try
{
try
{
_logger.Information("Shard {ShardId}: Requesting identify at gateway queue {GatewayQueueUrl}",
shard, _url);
await _httpClient.GetAsync(_url);
return;
}
catch (TimeoutException)
{
}
_logger.Information("Shard {ShardId}: Requesting identify at gateway queue {GatewayQueueUrl}",
shard, _url);
await _httpClient.GetAsync(_url);
return;
}
}
catch (TimeoutException) { }
}
}