1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-12 00:50:53 +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.
var Configuration *ConfigFile
var janitorsOnce sync.Once
// 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.
// (Uses http.DefaultServeMux if `serveMux` is nil.)
@ -106,14 +108,16 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
logstasher.Setup(Configuration.ESServer, Configuration.ESIndexPrefix, Configuration.ESHostName)
}
go authorizationJanitor()
go bunchCacheJanitor()
go pubsubJanitor()
go aggregateDataSender()
go commandCounter()
janitorsOnce.Do(func() {
go authorizationJanitor()
go bunchCacheJanitor()
go pubsubJanitor()
go aggregateDataSender()
go commandCounter()
go ircConnection()
go shutdownHandler()
go ircConnection()
go shutdownHandler()
})
}
func shutdownHandler() {