From e65f16e3c2fb818fee430ffb8320630cc749c207 Mon Sep 17 00:00:00 2001 From: Richard Artoul Date: Mon, 22 Oct 2018 16:23:33 -0400 Subject: [PATCH] reorder ifs --- src/dbnode/persist/fs/commitlog/commit_log.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dbnode/persist/fs/commitlog/commit_log.go b/src/dbnode/persist/fs/commitlog/commit_log.go index 2e95b70c42..18077fb42e 100644 --- a/src/dbnode/persist/fs/commitlog/commit_log.go +++ b/src/dbnode/persist/fs/commitlog/commit_log.go @@ -334,11 +334,6 @@ func (l *commitLog) flushEvery(interval time.Duration) { func (l *commitLog) write() { for write := range l.writes { - // For writes requiring acks add to pending acks - if write.eventType == writeEventType && write.callbackFn != nil { - l.pendingFlushFns = append(l.pendingFlushFns, write.callbackFn) - } - if write.eventType == flushEventType { // TODO(rartoul): This should probably be replaced with a call to Sync() as the expectation // is that the commitlog will actually FSync the data at regular intervals, whereas Flush @@ -360,6 +355,11 @@ func (l *commitLog) write() { continue } + // For writes requiring acks add to pending acks + if write.eventType == writeEventType && write.callbackFn != nil { + l.pendingFlushFns = append(l.pendingFlushFns, write.callbackFn) + } + if now := l.nowFn(); !now.Before(l.writerState.writerExpireAt) { err := l.openWriter(now) if err != nil {