mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-56611: Move license expiration check to be synchronous (#26010)
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
```
This commit is contained in:
parent
2d7a14244f
commit
6d41ee171e
@ -529,9 +529,9 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
}
|
||||
|
||||
func (s *Server) runJobs() {
|
||||
s.runLicenseExpirationCheckJob()
|
||||
s.Go(func() {
|
||||
appInstance := New(ServerConnector(s.Channels()))
|
||||
s.runLicenseExpirationCheckJob()
|
||||
runDNDStatusExpireJob(appInstance)
|
||||
runPostReminderJob(appInstance)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user