Skip to content

Commit

Permalink
reorder ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Artoul committed Oct 23, 2018
1 parent d5d1543 commit e65f16e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/dbnode/persist/fs/commitlog/commit_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit e65f16e

Please sign in to comment.