maybe try limiting results to two days worth

This commit is contained in:
Ted Unangst 2019-04-13 23:04:17 -04:00
parent b867a2bba3
commit da61c262ec
1 changed files with 3 additions and 2 deletions

View File

@ -566,7 +566,8 @@ func gethonksbyuser(name string) []*Honk {
return getsomehonks(rows, err) return getsomehonks(rows, err)
} }
func gethonksforuser(userid int64) []*Honk { func gethonksforuser(userid int64) []*Honk {
rows, err := stmtHonksForUser.Query(userid) dt := time.Now().UTC().Add(-2 * 24 * time.Hour)
rows, err := stmtHonksForUser.Query(userid, dt.Format(dbtimeformat))
return getsomehonks(rows, err) return getsomehonks(rows, err)
} }
func gethonksbyhonker(userid int64, honker string) []*Honk { func gethonksbyhonker(userid int64, honker string) []*Honk {
@ -997,7 +998,7 @@ func prepareStatements(db *sql.DB) {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
stmtHonksForUser, err = db.Prepare("select honkid, honks.userid, users.username, what, honker, xid, rid, dt, url, audience, noise from honks join users on honks.userid = users.userid where honks.userid = ? order by honkid desc limit 50") stmtHonksForUser, err = db.Prepare("select honkid, honks.userid, users.username, what, honker, xid, rid, dt, url, audience, noise from honks join users on honks.userid = users.userid where honks.userid = ? and dt > ? order by honkid desc limit 250")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }