Update license max usage count immediately upon switching licenses
Created by: dadlerj
Confusion around this affected https://app.hubspot.com/contacts/2762526/company/2243289985
The license compliance code doesn't just query the count of users when you load the /site-admin/overview or /site-admin/license pages, because it has to compare the purchased amount to the max amount you've ever had. Otherwise, a company could just delete users down at the end of the month and avoid any true-up charges.
We run a small background job that counts users every 6 hours, and stores max = max(previous max, current)
: https://sourcegraph.com/github.com/sourcegraph/sourcegraph@2ae7829cb0c91a9ed9e553c08d2cf4f3a19ff695/-/blob/enterprise/cmd/frontend/internal/licensing/licenseusercount.go#L143:22
When a customer switches to a new license, we clear the max, so they can start over with a fresh slate.
This works just fine for most cases, but when a customer plugs in a new license, they'll suddenly be shocked to see zero users for up to 6 hours following that change.
We should simply update the license max usage count immediately upon switching license keys.