good morning!!!!

Skip to content
Snippets Groups Projects
Verified Commit b4f7b808 authored by a's avatar a
Browse files

simplify

parent 8ba87a2f
No related branches found
No related tags found
1 merge request!19Simplify
Pipeline #28673 failed with stage
in 12 minutes and 12 seconds
......@@ -165,6 +165,7 @@ func (s *Server) Stop() {
type callResponder struct {
remote codec.ReaderWriter
mu sync.Mutex
}
type notifyEnv struct {
......@@ -174,6 +175,9 @@ type notifyEnv struct {
}
func (c *callResponder) notify(ctx context.Context, env *notifyEnv) error {
c.mu.Lock()
defer c.mu.Unlock()
defer c.remote.Flush()
enc := jx.GetEncoder()
enc.Grow(4096)
enc.ResetWriter(c.remote)
......@@ -197,7 +201,11 @@ func (c *callResponder) notify(ctx context.Context, env *notifyEnv) error {
if err != nil {
return err
}
return enc.Close()
err = enc.Close()
if err != nil {
return err
}
return nil
}
type callEnv struct {
......@@ -206,6 +214,9 @@ type callEnv struct {
}
func (c *callResponder) send(ctx context.Context, env *callEnv) (err error) {
c.mu.Lock()
defer c.mu.Unlock()
defer c.remote.Flush()
// notification gets nothing
// if all msgs in batch are notification, we trigger an allSkip and write nothing
if env.batch {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment