mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-13 14:34:15 +01:00
fix crash on calculating system statistics
This commit is contained in:
parent
a416521aab
commit
c3365c524c
1 changed files with 9 additions and 2 deletions
|
|
@ -92,10 +92,17 @@ public class SystemInfoService : IHostedService, IDisposable
|
|||
int uploadedFiles = 0;
|
||||
var loggedInUsers = dbContext.Users.Count(u => !string.IsNullOrEmpty(u.CharacterIdentification));
|
||||
var localCacheSize = Directory.EnumerateFiles(_configuration["CacheDirectory"])
|
||||
.Sum(f =>
|
||||
.ToList().Sum(f =>
|
||||
{
|
||||
uploadedFiles++;
|
||||
return new FileInfo(f).Length;
|
||||
try
|
||||
{
|
||||
return new FileInfo(f).Length;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
var totalNetworkOut = bytesSent / totalSPassed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue