loop on discovery

This commit is contained in:
mr
2026-02-03 09:37:53 +01:00
parent 30e6c9a618
commit 4f28b9b589

View File

@@ -61,8 +61,12 @@ func (s State) String() string {
type API struct{} type API struct{}
func (a *API) Discovered(infos []*beego.ControllerInfo) { func (a *API) Discovered(infos []*beego.ControllerInfo) {
respondToDiscovery := func(m NATSResponse) { respondToDiscovery := func(resp NATSResponse) {
a.SubscribeRouter(infos) var m map[string]interface{}
json.Unmarshal(resp.Payload, &m)
if len(m) == 0 {
a.SubscribeRouter(infos)
}
} }
a.ListenRouter(respondToDiscovery) a.ListenRouter(respondToDiscovery)
a.SubscribeRouter(infos) a.SubscribeRouter(infos)