Update user counts on self-managed instances when a new license is applied
What does this MR do and why?
On self-managed instances, when a new license is applied, the user counts do not automatically update on the Admin Area subscription page (/admin/subscription
):
Some numbers can be partly updated manually (the circular icon by the Last sync
value):
However, for all these numbers to update, customers must wait until the worker (Analytics::UsageTrends::CountJobTriggerWorker
) runs. We can improve the user experience by running the child worker of CountJobTriggerWorker
- Analytics::UsageTrends::CounterJobWorker
- as soon as a license is applied.
This MR adds a new after_commit
method to the License
model - update_billable_user_counts
- which runs that worker on license creation.
References
- Issue: Update user counts when applying a new SM license (#426797)
- Process for updating user billing data
Screenshots or screen recordings
Before applying license | After applying license | Notes |
---|---|---|
![]() |
![]() |
Before the change, the user counts did not register a new user being added. After the change, that number has correctly updated. |
How to set up and validate locally
- Start GDK in self-managed mode, as well as CustomersDot.
- Create a new user on GDK.
- Log out, then log in as the admin users.
- Navigate to https://gdk.test:3443/admin/subscription and note the user counts.
- Create a new license on CustomersDot (Premium or Ultimate) and use the activation code to activate it on the same GDK subscription page.
- Wait for some minutes for the counts to update. All numbers should be correct and account for the new user.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.