Browse Source

refactor use push

Xiang Li 12 years ago
parent
commit
0d8510df33
2 changed files with 2 additions and 4 deletions
  1. 1 2
      store/node.go
  2. 1 2
      store/store.go

+ 1 - 2
store/node.go

@@ -1,7 +1,6 @@
 package store
 
 import (
-	"container/heap"
 	"path"
 	"sort"
 	"sync"
@@ -387,7 +386,7 @@ func (n *Node) UpdateTTL(expireTime time.Time) {
 		if !expireTime.IsZero() {
 			// from permanent to ttl
 			// push into ttl heap
-			heap.Push(n.store.TTLKeyHeap, n)
+			n.store.TTLKeyHeap.push(n)
 		}
 	}
 

+ 1 - 2
store/store.go

@@ -1,7 +1,6 @@
 package store
 
 import (
-	"container/heap"
 	"encoding/json"
 	"fmt"
 	"path"
@@ -394,7 +393,7 @@ func (s *store) internalCreate(nodePath string, value string, unique bool, repla
 
 	// Node with TTL
 	if !n.IsPermanent() {
-		heap.Push(s.TTLKeyHeap, n)
+		s.TTLKeyHeap.push(n)
 
 		n.Expire()
 		e.Expiration, e.TTL = n.ExpirationAndTTL()