The order of booting up a server should be
Job scheduler -> Cluster.
And shutdown should be the opposite. This is needed because the job scheduler
initializes certain data structures that are later called by ClusterLeaderChanged
event handlers. And the event handlers run in a separate goroutine.
Therefore, if the cluster initialization happens before the job scheduler,
then a race happens between accessing the jobs variable and setting it.
To prevent this race, we fix the order of startup, and add comments in both
places to prevent things from regressing again.
* Consistent license message for all the go files
* Fixing the last set of unconsistencies with the license headers
* Addressing PR review comments
* Fixing busy.go and busy_test.go license header
* Moving goroutine pool
* Auto refactor
* Moving plugins.
* Auto refactor
* Moving fields to server
* Auto refactor
* Removing siteurl duplication.
* Moving reset of app fields
* Auto refactor
* Formatting
* Moving niling of Server to after last use
* Fixing unit tests.
Purpose of this is to make in-field debugging of cluster leader issues
(particularly around duplicate job scheduling) easier to debug from
production server logs.