mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-26 15:35:46 +00:00
feat(mqtt): start monitor after api server
closes #435 Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
parent
6ec84d9395
commit
853ad35cd9
@ -955,6 +955,12 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) {
|
||||
// RegisterNodeService implements the Application.RegisterNodeService method.
|
||||
func (app *App) RegisterNodeService(clientCtx client.Context) {
|
||||
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
|
||||
// HACK: start mqtt monitor as late as possible (hint: look in vendor directory for startup order)
|
||||
mqttMonitorInstance := monitor.GetMqttMonitorInstance()
|
||||
err := mqttMonitorInstance.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// initParamsKeeper init params keeper and its subspaces
|
||||
|
||||
@ -25,6 +25,12 @@ func SetMqttMonitorInstance(monitorInstance MQTTMonitorClientI) {
|
||||
monitorMutex.Unlock()
|
||||
}
|
||||
|
||||
func GetMqttMonitorInstance() (monitorInstance MQTTMonitorClientI) {
|
||||
monitorMutex.Lock()
|
||||
defer monitorMutex.Unlock()
|
||||
return mqttMonitorInstance
|
||||
}
|
||||
|
||||
func LazyMqttMonitorLoader(logger log.Logger, homeDir string) {
|
||||
monitorMutex.RLock()
|
||||
tmpInstance := mqttMonitorInstance
|
||||
@ -44,10 +50,6 @@ func LazyMqttMonitorLoader(logger log.Logger, homeDir string) {
|
||||
}
|
||||
|
||||
SetMqttMonitorInstance(NewMqttMonitorService(aciveActorsDB, *config.GetConfig()))
|
||||
err = mqttMonitorInstance.Start()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func SelectPoPParticipantsOutOfActiveActors() (challenger string, challengee string, err error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user