fix bug in update ttl

release-0.4
Xiang Li 2013-11-05 22:18:54 -08:00
parent 49c55477e5
commit 779195eb4f
1 changed files with 2 additions and 2 deletions

View File

@ -286,6 +286,7 @@ func (n *Node) UpdateTTL(expireTime time.Time) {
n.store.ttlKeyHeap.remove(n)
} else {
// update ttl
n.ExpireTime = expireTime
// update ttl heap
n.store.ttlKeyHeap.update(n)
}
@ -293,12 +294,11 @@ func (n *Node) UpdateTTL(expireTime time.Time) {
} else {
if !expireTime.IsZero() {
// from permanent to ttl
n.ExpireTime = expireTime
// push into ttl heap
n.store.ttlKeyHeap.push(n)
}
}
n.ExpireTime = expireTime
}
// Clone function clone the node recursively and return the new node.