fix some performance issues

This commit is contained in:
rootdarkarchon
2023-01-05 17:57:30 +01:00
parent 7e87dc61e7
commit 90a25c23dc
5 changed files with 25 additions and 9 deletions

View File

@@ -179,13 +179,15 @@ public class PlayerManager : IDisposable
token.ThrowIfCancellationRequested();
}
while (!PermanentDataCache.IsReady && !token.IsCancellationRequested)
int timeOut = 10000;
while (!PermanentDataCache.IsReady && !token.IsCancellationRequested && timeOut >= 0)
{
Logger.Verbose("Waiting until cache is ready");
Logger.Verbose("Waiting until cache is ready (Timeout: " + TimeSpan.FromMilliseconds(timeOut) + ")");
await Task.Delay(50, token).ConfigureAwait(false);
timeOut -= 50;
}
if (token.IsCancellationRequested) return null;
if (token.IsCancellationRequested || timeOut <= 0) return null;
Logger.Verbose("Cache creation complete");