mirror of https://github.com/tidwall/tile38.git
net prewrite optimization
This commit is contained in:
parent
464c193d73
commit
d065b979da
|
@ -653,14 +653,18 @@ func (server *Server) netServe() error {
|
||||||
|
|
||||||
// write to client
|
// write to client
|
||||||
if len(client.out) > 0 {
|
if len(client.out) > 0 {
|
||||||
func() {
|
if atomic.LoadInt32(&server.aofdirty) != 0 {
|
||||||
// prewrite
|
func() {
|
||||||
server.mu.Lock()
|
// prewrite
|
||||||
defer server.mu.Unlock()
|
server.mu.Lock()
|
||||||
server.flushAOF()
|
defer server.mu.Unlock()
|
||||||
}()
|
server.flushAOF()
|
||||||
|
}()
|
||||||
|
atomic.StoreInt32(&server.aofdirty, 0)
|
||||||
|
}
|
||||||
conn.Write(client.out)
|
conn.Write(client.out)
|
||||||
client.out = nil
|
client.out = nil
|
||||||
|
|
||||||
}
|
}
|
||||||
if close {
|
if close {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue