Skip to content

Commit

Permalink
opt: mitigate the latency issue by prioritizing asynchronous writes
Browse files Browse the repository at this point in the history
Fixes #423
  • Loading branch information
panjf2000 committed Mar 29, 2024
1 parent f7cfb5b commit e2d2ee3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions connection_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,14 @@ func (c *conn) AsyncWrite(buf []byte, callback AsyncCallback) error {
}
return err
}
return c.loop.poller.Trigger(c.asyncWrite, &asyncWriteHook{callback, buf})
return c.loop.poller.UrgentTrigger(c.asyncWrite, &asyncWriteHook{callback, buf})
}

func (c *conn) AsyncWritev(bs [][]byte, callback AsyncCallback) error {
if c.isDatagram {
return errorx.ErrUnsupportedOp
}
return c.loop.poller.Trigger(c.asyncWritev, &asyncWritevHook{callback, bs})
return c.loop.poller.UrgentTrigger(c.asyncWritev, &asyncWritevHook{callback, bs})
}

func (c *conn) Wake(callback AsyncCallback) error {
Expand Down

0 comments on commit e2d2ee3

Please sign in to comment.