Răsfoiți Sursa

Use nicer count comparitor

Joshua M. Boniface 4 ani în urmă
părinte
comite
67e89dd525
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      Emby.Server.Implementations/Session/SessionManager.cs

+ 1 - 1
Emby.Server.Implementations/Session/SessionManager.cs

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