Skip to content

Commit c76e9b9

Browse files
committed
kbfsedits: address review feedback from songgao
Issue: keybase#1626
1 parent f26467c commit c76e9b9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

kbfsedits/tlf_history.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,12 @@ func (th *TlfHistory) recomputeLocked() (
311311
}
312312
}
313313
sort.Sort(history)
314-
// Garbage-collect any writers that don't appear in the history.
315-
for i := maxWritersPerHistory; i < len(history); i++ {
316-
delete(th.byWriter, history[i].writerName)
317-
delete(writersWhoNeedMore, history[i].writerName)
318-
}
319314
if len(history) > maxWritersPerHistory {
315+
// Garbage-collect any writers that don't appear in the history.
316+
for i := maxWritersPerHistory; i < len(history); i++ {
317+
delete(th.byWriter, history[i].writerName)
318+
delete(writersWhoNeedMore, history[i].writerName)
319+
}
320320
history = history[:maxWritersPerHistory]
321321
}
322322
th.computed = true
@@ -328,7 +328,10 @@ func (th *TlfHistory) getHistoryIfCached() (
328328
cached bool, history writersByRevision) {
329329
th.lock.RLock()
330330
defer th.lock.RUnlock()
331-
return th.computed, th.cachedHistory
331+
if th.computed {
332+
return true, th.cachedHistory
333+
}
334+
return false, nil
332335
}
333336

334337
func (th *TlfHistory) getHistory() writersByRevision {

0 commit comments

Comments
 (0)