From 28aebe856f5c91e01b85cfcf3e4991bc9ebe9fe1 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 11 Dec 2017 16:12:15 -0800 Subject: [PATCH] Flush to file periodically --- controller/aofshrink.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controller/aofshrink.go b/controller/aofshrink.go index 05654c21..3cfac7b5 100644 --- a/controller/aofshrink.go +++ b/controller/aofshrink.go @@ -169,12 +169,12 @@ func (c *Controller) aofshrink() { ) }() - } - if len(aofbuf) > maxchunk { - if _, err := f.Write(aofbuf); err != nil { - return err + if len(aofbuf) > maxchunk { + if _, err := f.Write(aofbuf); err != nil { + return err + } + aofbuf = aofbuf[:0] } - aofbuf = aofbuf[:0] } }