for now, no chats older than 3 days

This commit is contained in:
Ted Unangst 2020-05-23 19:05:23 -04:00
parent d30daa653a
commit 81425225e4
1 changed files with 3 additions and 2 deletions

View File

@ -539,7 +539,8 @@ func savechonk(ch *Chonk) error {
}
func loadchatter(userid int64) map[string][]*Chonk {
rows, err := stmtLoadChonks.Query(userid)
duedt := time.Now().Add(-3 * 24 * time.Hour).UTC().Format(dbtimeformat)
rows, err := stmtLoadChonks.Query(userid, duedt)
if err != nil {
log.Printf("error loading chonks: %s", err)
return nil
@ -899,5 +900,5 @@ func prepareStatements(db *sql.DB) {
stmtDeleteFilter = preparetodie(db, "delete from hfcs where userid = ? and hfcsid = ?")
stmtGetTracks = preparetodie(db, "select fetches from tracks where xid = ?")
stmtSaveChonk = preparetodie(db, "insert into chonks (userid, xid, who, target, dt, noise, format) values (?, ?, ?, ?, ?, ?, ?)")
stmtLoadChonks = preparetodie(db, "select chonkid, userid, xid, who, target, dt, noise, format from chonks where userid = ?")
stmtLoadChonks = preparetodie(db, "select chonkid, userid, xid, who, target, dt, noise, format from chonks where userid = ? and dt > ? order by chonkid asc")
}