diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-10-29 01:33:33 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-10-29 01:33:33 -0700 |
commit | b6eb040045fcfeb39dda4fcd440d2be184c8e715 (patch) | |
tree | f33b8374b9addf5f3a936ed0d555d0ea5d2904a1 /system/db/content.go | |
parent | 30ea59f0d1cae4229490596efba22f9d9b298f4c (diff) |
adding db/analytics init back in after reverting for debug
Diffstat (limited to 'system/db/content.go')
-rw-r--r-- | system/db/content.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/system/db/content.go b/system/db/content.go index 6e70c1b..8eb42b3 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -202,8 +202,8 @@ func ContentAll(namespace string) [][]byte { store.View(func(tx *bolt.Tx) error { b := tx.Bucket([]byte(namespace)) - len := b.Stats().KeyN - posts = make([][]byte, 0, len) + numKeys := b.Stats().KeyN + posts = make([][]byte, 0, numKeys) b.ForEach(func(k, v []byte) error { posts = append(posts, v) @@ -224,7 +224,7 @@ func SortContent(namespace string) { all := ContentAll(namespace) var posts sortablePosts - // decode each (json) into Editable + // decode each (json) into type to then sort for i := range all { j := all[i] post := content.Types[namespace]() @@ -243,11 +243,6 @@ func SortContent(namespace string) { // store in <namespace>_sorted bucket, first delete existing err := store.Update(func(tx *bolt.Tx) error { - err := tx.DeleteBucket([]byte(namespace + "_sorted")) - if err != nil { - return err - } - b, err := tx.CreateBucket([]byte(namespace + "_sorted")) if err != nil { err := tx.Rollback() |