HancaiWang commented on issue #484: 为什么去掉instance对于Endpoints的排序?
URL: 
https://github.com/apache/servicecomb-service-center/issues/484#issuecomment-437376746
 
 
   建议添加如下3行代码来保持不变:
   func (this *MicroServiceInstanceService) RegisterInstance(w 
http.ResponseWriter, r *http.Request) {
        message, err := ioutil.ReadAll(r.Body)
        if err != nil {
                log.Error("register instance failed, body err", err)
                controller.WriteError(w, scerr.ErrInvalidParams, err.Error())
                return
        }
   
        request := &pb.RegisterInstanceRequest{}
        err = json.Unmarshal(message, request)
        if err != nil {
                log.Error("register instance failed, Unmarshal error", err)
                controller.WriteError(w, scerr.ErrInvalidParams, "Unmarshal 
error")
                return
        }
        if request.GetInstance() != nil {
                request.Instance.ServiceId = r.URL.Query().Get(":serviceId")
                if len(request.Instance.Endpoints) > 0 {
                        sort.Strings(request.Instance.Endpoints)
                }
        }
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to