diff options
author | Max Magorsch <arzano@gentoo.org> | 2020-06-23 18:46:21 +0200 |
---|---|---|
committer | Max Magorsch <arzano@gentoo.org> | 2020-06-23 18:46:21 +0200 |
commit | e2cb93d1c63654533f1eef60e83c119c996a82bc (patch) | |
tree | ebb89142eb70504b8c9fe1a491998fbfc528555e | |
parent | Increase the verbosity of cache updates (diff) | |
download | archives-e2cb93d1c63654533f1eef60e83c119c996a82bc.tar.gz archives-e2cb93d1c63654533f1eef60e83c119c996a82bc.tar.bz2 archives-e2cb93d1c63654533f1eef60e83c119c996a82bc.zip |
Speed up the computation of the index page
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r-- | pkg/app/home/home.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/pkg/app/home/home.go b/pkg/app/home/home.go index d0d3582..478fd21 100644 --- a/pkg/app/home/home.go +++ b/pkg/app/home/home.go @@ -8,7 +8,6 @@ import ( "archives/pkg/config" "archives/pkg/database" "archives/pkg/models" - "github.com/go-pg/pg/v10/orm" "net/http" "time" ) @@ -29,11 +28,7 @@ func ComputeTemplateData() interface{} { for _, mailingList := range config.IndexMailingLists() { var messages []*models.Message database.DBCon.Model(&messages). - WhereGroup(func(q *orm.Query) (*orm.Query, error) { - q = q.WhereOr(`subject LIKE '[` + mailingList[0] + `]%'`). - WhereOr(`subject LIKE 'Re: [` + mailingList[0] + `]%'`) - return q, nil - }). + Where("list = ?", mailingList[0]). Order("date DESC"). Limit(5). Select() |