Calculate licenced users correctly

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Low
    • None
    • Affects Version/s: 2.7.3
    • Component/s: None

      The whole implementation of the DefaultUserChecker can definitely be improved! The method called inside the viewlicence.vm

      #if (!$userChecker.unlimitedUserLicense)
                          ($userChecker.getNumberOfRegisteredUsers() signed up currently)<br/>
      
      uses the getNumberOfRegisteredUsers
      
      public int getNumberOfRegisteredUsers()
          {
              return getNumberOfRegisteredUsers(RETRIES);
          }
      
          public int getNumberOfRegisteredUsers(int retries)
          {
              if (isUnlimitedUserLicense())
                  return UNLIMITED_USERS;
      
              if (getCacheManager() == null)
                  PagerUtils.toList(getUserAccessor().getUsersWithConfluenceAccess()).size();
      
              if (retries == 0) // obviously, the calculation is taking a while, return -1 for now
                  return -1;
      
              Integer cachedResult = null;
              try
              {
                  cachedResult = (Integer) getCache().get(NUMBER_OF_REGISTERED_USERS);
              }
              catch (Exception e)
              {
                  log.error("Error result from cache.", e);
              }
      
              if (cachedResult == null)
              {
                  determineRegisteredUsersInBackgroundThread();
      
                  try
                  {
                      Thread.sleep(500); // stagger the retry a little, to give the calculation a chance to complete for small user sets
                  }
                  catch (InterruptedException e)
                  {
                      e.printStackTrace();
                  }
      
                  return getNumberOfRegisteredUsers(--retries);
              }
              else
              {
                  return cachedResult.intValue();
              }
          }
      
      • improve calculation of users
      • display users count also when unlimited licence is used It would be useful to know the number of active users without depending on the actual licence

            Assignee:
            Unassigned
            Reporter:
            Ivan Benko [Atlassian]
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: