clean up new builds monitor

This commit is contained in:
13xforever 2020-03-24 11:42:23 +05:00
parent 1ca9dd05a1
commit 79045c7e77

View File

@ -34,28 +34,29 @@ namespace CompatBot.EventHandlers
{
var lastCheck = DateTime.UtcNow.AddDays(-1);
var resetThreshold = TimeSpan.FromMinutes(10);
try
Exception lastException = null;
while (!Config.Cts.IsCancellationRequested)
{
while (!Config.Cts.IsCancellationRequested)
if (DateTime.UtcNow - lastCheck > CheckInterval)
{
try
{
if (DateTime.UtcNow - lastCheck > CheckInterval)
await CompatList.UpdatesCheck.CheckForRpcs3Updates(client, null).ConfigureAwait(false);
}
catch (Exception e)
{
if (e.GetType() != lastException?.GetType())
{
await CompatList.UpdatesCheck.CheckForRpcs3Updates(client, null).ConfigureAwait(false);
lastCheck = DateTime.UtcNow;
if (DateTime.UtcNow - resetThreshold > RapidStart)
Reset();
Config.Log.Debug(e);
lastException = e;
}
}
catch
{
lastCheck = DateTime.UtcNow;
}
await Task.Delay(1000, Config.Cts.Token).ConfigureAwait(false);
lastCheck = DateTime.UtcNow;
if (DateTime.UtcNow - resetThreshold > RapidStart)
Reset();
}
await Task.Delay(1000, Config.Cts.Token).ConfigureAwait(false);
}
catch (Exception e) { Config.Log.Error(e); }
}
public static void Reset()