all repos — honk @ 84ca26f386e4216a3689b2e1a019b1e0389c3e4a

my fork of honk

date limit more queries to reduce response size
Ted Unangst tedu@tedunangst.com
Fri, 03 May 2019 15:28:56 -0400
commit

84ca26f386e4216a3689b2e1a019b1e0389c3e4a

parent

3232f951e9f9a3b00a25f23e131aca3b50d7df9a

1 files changed, 10 insertions(+), 8 deletions(-)

jump to
M honk.gohonk.go

@@ -650,21 +650,23 @@ return &h

} func getpublichonks() []*Honk { - rows, err := stmtPublicHonks.Query() + dt := time.Now().UTC().Add(-2 * 24 * time.Hour).Format(dbtimeformat) + rows, err := stmtPublicHonks.Query(dt) return getsomehonks(rows, err) } func gethonksbyuser(name string) []*Honk { - rows, err := stmtUserHonks.Query(name) + dt := time.Now().UTC().Add(-2 * 24 * time.Hour).Format(dbtimeformat) + rows, err := stmtUserHonks.Query(name, dt) return getsomehonks(rows, err) } func gethonksforuser(userid int64) []*Honk { - dt := time.Now().UTC().Add(-2 * 24 * time.Hour) - rows, err := stmtHonksForUser.Query(userid, dt.Format(dbtimeformat), userid) + dt := time.Now().UTC().Add(-2 * 24 * time.Hour).Format(dbtimeformat) + rows, err := stmtHonksForUser.Query(userid, dt, userid) return getsomehonks(rows, err) } func gethonksforme(userid int64) []*Honk { - dt := time.Now().UTC().Add(-4 * 24 * time.Hour) - rows, err := stmtHonksForMe.Query(userid, dt.Format(dbtimeformat), userid) + dt := time.Now().UTC().Add(-4 * 24 * time.Hour).Format(dbtimeformat) + rows, err := stmtHonksForMe.Query(userid, dt, userid) return getsomehonks(rows, err) } func gethonksbyhonker(userid int64, honker string) []*Honk {

@@ -1330,8 +1332,8 @@ selecthonks := "select honkid, honks.userid, username, what, honker, honks.xid, rid, dt, url, audience, noise, convoy from honks join users on honks.userid = users.userid "

limit := " order by honkid desc limit 250" butnotthose := " and convoy not in (select name from zonkers where userid = ? and wherefore = 'zonvoy' order by zonkerid desc limit 100)" stmtOneXonk = preparetodie(db, selecthonks+"where xid = ?") - stmtPublicHonks = preparetodie(db, selecthonks+"where honker = ''"+limit) - stmtUserHonks = preparetodie(db, selecthonks+"where honker = '' and username = ?"+limit) + stmtPublicHonks = preparetodie(db, selecthonks+"where honker = '' and dt > ?"+limit) + stmtUserHonks = preparetodie(db, selecthonks+"where honker = '' and username = ? and dt > ?"+limit) stmtHonksForUser = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ?"+butnotthose+limit) stmtHonksForMe = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit) stmtHonksByHonker = preparetodie(db, selecthonks+"join honkers on honkers.xid = honks.honker where honks.userid = ? and honkers.name = ?"+butnotthose+limit)