loop on discovery
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user