Paring session 2019-08-22 Muhamed/Vlad
Overview:
We paired because @mhuseinbasic had previously shown a few of us how the "Maximum Users" value is computed for a customer and how we can force the Historical data worker to run on demand (and not wait for Sideqik to run it as a cron job) in #851 (closed) and I tried to reproduce that myself but couldn't get it to work in the same fashion.
We went through the same process:
- Created a new Gitlab instance
- Added an Ultimate license (doesn't necessarily need to be Ultimate)
- Created a few users
- Created projects for each user
- Added users as members to projects that they did not own and gave them the role of "developer" or "maintainer"
- Ran the Historical Data worker to aggregate the number of users and calculate the "Maximum Users" value.
The result should have been that the "Maximum Users" value would reflect all the users that met the criteria described above + the admin, but it actually never amounted to anything other than 0.
We started digging and what we initially thought was a UI issue specific to my environment turned out to be a possible bug in historical_data.rb.
In short, it looks like the code calculates the "Maximum Users" value (max_historical_user_count
in the code) only for the one year interval before the license expires, and while that does work for licenses that are valid for 1 year (because presently the instance would operate in that interval), in this particular case my license had an expiration date of 16 years and therefore all my tinkering around with users would not be relevant for another 15 years :)
We did not know if this was intended behaviour as @mhuseinbasic said that usually a client that has a 2 year contract, would get 2 licenses (1 for each year) and this would be covered by the code so the simplicity of the logic seems intentional, but that does not mean it could not be slightly improved to cover cases where licenses stretch to more than 1 year.
Tickets Worked On:
@mhuseinbasic said that he may open an issue to see if this could be improved
Documentation MRs and Issues:
@mhuseinbasic will post issue here if there really is a need for one + +