tornado-ssy commented on code in PR #294:
URL: https://github.com/apache/servicecomb-kie/pull/294#discussion_r1307114393
##########
server/resource/v1/kv_resource.go:
##########
@@ -262,12 +262,14 @@ func isLegalWaitRequest(rctx *restful.Context, request
*model.ListKVRequest) boo
return true
}
func watch(rctx *restful.Context, request *model.ListKVRequest, wait string)
bool {
+ ctx, cancel := context.WithCancel(rctx.Ctx)
+ defer cancel()
Review Comment:
1,rctx.Ctx是timerContext类型的,该类型的context没有Value方法,所以包装为cacelContext类型
2,cancelContext使用完毕后需要调用cancel方法销毁该context,不然会导致context泄漏
##########
server/resource/v1/kv_resource.go:
##########
@@ -262,12 +262,14 @@ func isLegalWaitRequest(rctx *restful.Context, request
*model.ListKVRequest) boo
return true
}
func watch(rctx *restful.Context, request *model.ListKVRequest, wait string)
bool {
+ ctx, cancel := context.WithCancel(rctx.Ctx)
+ defer cancel()
Review Comment:
1,rctx.Ctx是timerContext类型的,该类型的context没有Value方法,所以包装为cacelContext类型
2,cancelContext使用完毕后需要调用cancel方法销毁该context,不然会导致context泄漏
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]