mirror of
https://github.com/smallnest/rpcx.git
synced 2025-09-26 20:21:14 +08:00
#743 refactor to improve the performance
This commit is contained in:
@@ -502,7 +502,10 @@ func (s *Server) serveConn(conn net.Conn) {
|
||||
func (s *Server) processOneRequest(ctx *share.Context, req *protocol.Message, conn net.Conn, writeCh chan *[]byte) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Errorf("failed to handle the request: %v", r)
|
||||
buf := make([]byte, 1024)
|
||||
buf = buf[:runtime.Stack(buf, true)]
|
||||
|
||||
log.Errorf("failed to handle the request: %v, stacks: %s", r, buf)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@@ -82,7 +82,7 @@ func WithValue(parent context.Context, key, val interface{}) *Context {
|
||||
|
||||
tags := make(map[interface{}]interface{})
|
||||
tags[key] = val
|
||||
return &Context{Context: parent, tags: tags}
|
||||
return &Context{Context: parent, tags: tags, tagsLock: &sync.Mutex{}}
|
||||
}
|
||||
|
||||
func WithLocalValue(ctx *Context, key, val interface{}) *Context {
|
||||
|
Reference in New Issue
Block a user