فهرست منبع

updated to Release the LevelDB iterator and also check for Error. Becuase fully
reading documentation is truly elightening.

Steve Brunton 10 سال پیش
والد
کامیت
135c74afc6
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      context/context.go

+ 4 - 1
context/context.go

@@ -163,6 +163,7 @@ func (c *Context) Del(key string) error {
 func (c *Context) GetAll() (map [string]Route, error) {
 	golinks := map[string]Route{}
 	iter := c.db.NewIterator(nil, nil)
+
 	for iter.Next() {
 		key := iter.Key()
 		val := iter.Value()
@@ -172,8 +173,10 @@ func (c *Context) GetAll() (map [string]Route, error) {
 		}
 		golinks[string(key[:])] = *rt
 	}
+	iter.Release()
+	err := iter.Error()
 
-	return golinks, nil
+	return golinks, err
 }
 
 func (c *Context) commit(id uint64) error {