tianxiaoliang commented on a change in pull request #90: #79 record polling
history
URL: https://github.com/apache/servicecomb-kie/pull/90#discussion_r378239415
##########
File path: server/resource/v1/kv_resource.go
##########
@@ -191,21 +198,47 @@ func returnData(rctx *restful.Context, domain
interface{}, project string, label
DomainID: domain.(string),
})
if err != nil {
- WriteErrResponse(rctx, http.StatusBadRequest,
err.Error(), common.ContentTypeText)
+ WriteErrResponseWithRecord(rctx,
http.StatusBadRequest, err.Error(), common.ContentTypeText, recordData)
return
}
if changed {
- queryAndResponse(rctx, domain, project, "",
labels, limit, offset, status)
+ queryAndResponse(rctx, domain, project, "",
labels, limit, offset, status, recordData)
return
}
rctx.WriteHeader(http.StatusNotModified)
- return
+ _, recordErr =
service.RecordService.RecordSuccess(rctx.Ctx, recordData,
http.StatusNotModified, "", "")
Review comment:
太多地方需要考虑调用,不如用defer+一个func,虽然损失性能,但是优雅易维护
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services