From aef933f144a89e947d8ccdae8e085eed221e2bdd Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Tue, 18 Oct 2016 13:56:22 -0700 Subject: implement Sort on all content types by Timestamp, DESC (latest to oldest) - run in goroutine on db.Init() as well as any time content is saved via SetContent --- system/db/init.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/db/init.go b/system/db/init.go index d035510..5806622 100644 --- a/system/db/init.go +++ b/system/db/init.go @@ -33,8 +33,6 @@ func Init() { if err != nil { return err } - - go SortContent(t + "_sorted") } // init db with other buckets as needed @@ -72,6 +70,11 @@ func Init() { log.Fatal("Coudn't initialize db with buckets.", err) } + // sort all content into type_sorted buckets + for t := range content.Types { + go SortContent(t + "_sorted") + } + } // SystemInitComplete checks if there is at least 1 admin user in the db which -- cgit v1.2.3