Ejemplo n.º 1
0
        public static void CalculateMaxTasksPerClient()
        {
            var premiumClientFactor = 1.5;

            var clientsStandardCount = LoggedClients.Where(c => !c.IsPremium).Count();
            var clientsPremiumCount  = LoggedClients.Where(c => c.IsPremium).Count();

            foreach (var client in LoggedClients)
            {
                if (client.IsPremium)
                {
                    client.MaxTasksCount = (int)(Configuration.MaxThreads / (clientsStandardCount / premiumClientFactor + clientsPremiumCount));
                }
                else
                {
                    client.MaxTasksCount = (int)(Configuration.MaxThreads / (clientsStandardCount + clientsPremiumCount * premiumClientFactor));
                }
            }
        }
Ejemplo n.º 2
0
 public static void LogClientIn(ClientAccount clientAccount)
 {
     LoggedClients.Add(clientAccount);
     CalculateMaxTasksPerClient();
     ClientLoggedIn?.Invoke(LoggedClients);
 }
Ejemplo n.º 3
0
 public static void LogClientOut(ClientAccount clientAccount)
 {
     LoggedClients.Remove(clientAccount);
     CalculateMaxTasksPerClient();
     ClientLoggedOut?.Invoke(LoggedClients);
 }