Revert "Implement better count method"

This reverts commit 5aa519fd39.
This commit is contained in:
Joshua M. Boniface 2020-10-04 15:52:39 -04:00
parent 5aa519fd39
commit df177b4752

View file

@ -1484,7 +1484,7 @@ namespace Emby.Server.Implementations.Session
throw new SecurityException("User is not allowed access from this device."); throw new SecurityException("User is not allowed access from this device.");
} }
int sessionsCount = Sessions.Count(i => string.Equals(i.UserId, user.Id, StringComparison.OrdinalIgnoreCase)); int sessionsCount = Sessions.Where(i => string.Equals(i.UserId, user.Id)).ToList().Count;
int maxActiveSessions = user.MaxActiveSessions; int maxActiveSessions = user.MaxActiveSessions;
_logger.LogInformation("Current/Max sessions for user {User}: {Sessions}/{Max}", user.Username, sessionsCount, maxActiveSessions); _logger.LogInformation("Current/Max sessions for user {User}: {Sessions}/{Max}", user.Username, sessionsCount, maxActiveSessions);
if (maxActiveSessions >= 1 && sessionsCount >= maxActiveSessions) if (maxActiveSessions >= 1 && sessionsCount >= maxActiveSessions)