This commit is contained in:
Maxim Merzhanov committed 2019-09-04 18:48:54 +03:00
1 parent 79f83e245c
commit 1ddbe43618
1 file changed
+9 -6
+9 -6
View File
@@ -31,14 +31,17 @@ func (h *socketEventHandler) handleModuleReady(conn ws.Conn, data []byte) string
logger.Warnf("SOCKET ROUTES ERROR, handleModuleDeclaration: %s, error validate routes data: %s", conn.Id(), errors)
return err.Error()
}
var changed bool
h.store.VisitReadState(func(state state.ReadState) {
if state.CheckBackendChanged(declaration) {
conn.SetBackendDeclaration(declaration)
command := service.ClusterStateService.PrepareUpdateBackendDeclarationCommand(declaration)
i, err := h.cluster.SyncApply(command)
logger.Debug("cluster.SyncApply:", i, err)
}
changed = state.CheckBackendChanged(declaration)
})
if changed {
conn.SetBackendDeclaration(declaration)
command := service.ClusterStateService.PrepareUpdateBackendDeclarationCommand(declaration)
i, err := h.cluster.SyncApply(command)
logger.Debug("cluster.SyncApply:", i, err)
}
return ok
}