提交 863d38df 编写于 作者: F Fabian Reinartz

Fix unreturned lock

上级 d0770302
......@@ -227,11 +227,13 @@ func (db *DB) run() {
}
func (db *DB) retentionCutoff() (bool, error) {
db.headmtx.RLock()
if db.opts.RetentionDuration == 0 {
return false, nil
}
db.mtx.RLock()
defer db.mtx.RUnlock()
// We don't count the span covered by head blocks towards the
// retention time as it generally makes up a fraction of it.
if len(db.persisted) == 0 {
......@@ -241,8 +243,6 @@ func (db *DB) retentionCutoff() (bool, error) {
last := db.persisted[len(db.persisted)-1]
mint := last.Meta().MaxTime - int64(db.opts.RetentionDuration)
db.headmtx.RUnlock()
return retentionCutoff(db.dir, mint)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册