aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-06-23 15:47:52 +0200
committerMax Magorsch <arzano@gentoo.org>2020-06-23 15:47:52 +0200
commit4c2901d7ab23134247397ba4eaf14e4d3b6035bb (patch)
tree34c982a9e220e6e77002888a3ec0019f82275495 /pkg
parentSpeed up loading the messages for a list (diff)
downloadarchives-4c2901d7ab23134247397ba4eaf14e4d3b6035bb.tar.gz
archives-4c2901d7ab23134247397ba4eaf14e4d3b6035bb.tar.bz2
archives-4c2901d7ab23134247397ba4eaf14e4d3b6035bb.zip
Speed up loading the threads for a list
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/app/list/threads.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/pkg/app/list/threads.go b/pkg/app/list/threads.go
index dfc9694..403f7db 100644
--- a/pkg/app/list/threads.go
+++ b/pkg/app/list/threads.go
@@ -3,7 +3,6 @@ package list
import (
"archives/pkg/database"
"archives/pkg/models"
- "github.com/go-pg/pg/v10/orm"
"math"
"net/http"
"strconv"
@@ -35,11 +34,7 @@ func Threads(w http.ResponseWriter, r *http.Request) {
Column("id", "subject", "from", "date").
Where("to_char(date, 'YYYY-MM') = ?", combinedDate).
Where(`starts_thread = TRUE`).
- WhereGroup(func(q *orm.Query) (*orm.Query, error) {
- q = q.WhereOr(`subject LIKE '[` + listName + `]%'`).
- WhereOr(`subject LIKE 'Re: [` + listName + `]%'`)
- return q, nil
- }).
+ Where("list = ?", listName).
Order("date DESC")
messagesCount, _ := query.Count()