mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
During server start, runLicenseExpirationCheckJob was being called
from a goroutine which would eventually call SetLicense and iterate
through the ps.licenseListeners.
But at the same time doElasticsearchFixChannelIndex would also
call AddLicenseListener and try to edit the ps.licenseListeners map,
leading to a race condition.
To fix this, we simply move the runLicenseExpirationCheckJob
to be synchronous. This fixes the race, and also improves
the correctness because after 1f431bf722
there was no license check being done synchronously during server boot.
So theoretically, the server might go on doing some stuff
until the Go runtime decides to run the license check goroutine.
https://mattermost.atlassian.net/browse/MM-56611
```release-note
NONE
```