diff --git a/internal/server/follow.go b/internal/server/follow.go index aea9a2d9..69878c52 100644 --- a/internal/server/follow.go +++ b/internal/server/follow.go @@ -129,6 +129,9 @@ func (c *Server) followHandleCommand(args []string, followc int, w io.Writer) (i if err := c.writeAOF(args, &d); err != nil { return c.aofsz, err } + if len(c.aofbuf) > 10240 { + c.flushAOF() + } return c.aofsz, nil } @@ -238,6 +241,7 @@ func (c *Server) followStep(host string, port int, followc int) error { if aofsz >= int(aofSize) { caughtUp = true c.mu.Lock() + c.flushAOF() c.fcup = true c.fcuponce = true c.mu.Unlock()