Handle requests concurrently
This commit is contained in:
parent
d35a16ec64
commit
7592eae318
@ -133,7 +133,6 @@ func (s *Server) execute(pCtx context.Context, typ string, name string, data []b
|
||||
|
||||
arg = argVal.Elem().Interface()
|
||||
|
||||
|
||||
ctx = newContext(pCtx, c)
|
||||
// Get reflect value of context
|
||||
ctxVal := reflect.ValueOf(ctx)
|
||||
@ -304,6 +303,7 @@ func (s *Server) handleConn(pCtx context.Context, c codec.Codec) {
|
||||
continue
|
||||
}
|
||||
|
||||
go func() {
|
||||
// Execute decoded call
|
||||
val, ctx, err := s.execute(
|
||||
pCtx,
|
||||
@ -318,7 +318,7 @@ func (s *Server) handleConn(pCtx context.Context, c codec.Codec) {
|
||||
valData, err := c.Marshal(val)
|
||||
if err != nil {
|
||||
s.sendErr(c, call, val, err)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
// Create response
|
||||
@ -332,7 +332,7 @@ func (s *Server) handleConn(pCtx context.Context, c codec.Codec) {
|
||||
idData, err := c.Marshal(ctx.channelID)
|
||||
if err != nil {
|
||||
s.sendErr(c, call, val, err)
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
// Set IsChannel to true
|
||||
@ -385,6 +385,8 @@ func (s *Server) handleConn(pCtx context.Context, c codec.Codec) {
|
||||
c.Encode(res)
|
||||
codecMtx.Unlock()
|
||||
}
|
||||
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user