1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-12 09:00:54 +00:00

Fix race condition during testing

This commit is contained in:
Kane York 2015-12-16 14:23:28 -08:00
parent 9f5eb5818a
commit 6f612f881e

View file

@ -59,6 +59,8 @@ var ResponseSuccess = ClientMessage{Command: SuccessCommand}
// Configuration is the active ConfigFile. // Configuration is the active ConfigFile.
var Configuration *ConfigFile var Configuration *ConfigFile
var janitorsOnce sync.Once
// SetupServerAndHandle starts all background goroutines and registers HTTP listeners on the given ServeMux. // SetupServerAndHandle starts all background goroutines and registers HTTP listeners on the given ServeMux.
// Essentially, this function completely preps the server for a http.ListenAndServe call. // Essentially, this function completely preps the server for a http.ListenAndServe call.
// (Uses http.DefaultServeMux if `serveMux` is nil.) // (Uses http.DefaultServeMux if `serveMux` is nil.)
@ -106,6 +108,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
logstasher.Setup(Configuration.ESServer, Configuration.ESIndexPrefix, Configuration.ESHostName) logstasher.Setup(Configuration.ESServer, Configuration.ESIndexPrefix, Configuration.ESHostName)
} }
janitorsOnce.Do(func() {
go authorizationJanitor() go authorizationJanitor()
go bunchCacheJanitor() go bunchCacheJanitor()
go pubsubJanitor() go pubsubJanitor()
@ -114,6 +117,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
go ircConnection() go ircConnection()
go shutdownHandler() go shutdownHandler()
})
} }
func shutdownHandler() { func shutdownHandler() {