all repos — honk @ 79799425f48c2f4bf99a0be8db4ed003faaa9b34

my fork of honk

should delete old pubkeys after a while and refresh
Ted Unangst tedu@tedunangst.com
Thu, 05 May 2022 14:55:32 -0400
commit

79799425f48c2f4bf99a0be8db4ed003faaa9b34

parent

bf8452e60f246f833d124eea26676a6e0e293647

2 files changed, 7 insertions(+), 1 deletions(-)

jump to
M database.godatabase.go

@@ -1096,7 +1096,7 @@ var stmtFindFile, stmtGetFileData, stmtSaveFileData, stmtSaveFile *sql.Stmt

var stmtCheckFileData *sql.Stmt var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover, stmtOneHonker *sql.Stmt var stmtUntagged, stmtDeleteHonk, stmtDeleteDonks, stmtDeleteOnts, stmtSaveZonker *sql.Stmt -var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker, stmtDeleteXonker *sql.Stmt +var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker, stmtDeleteXonker, stmtDeleteOldXonkers *sql.Stmt var stmtAllOnts, stmtSaveOnt, stmtUpdateFlags, stmtClearFlags *sql.Stmt var stmtHonksForUserFirstClass *sql.Stmt var stmtSaveMeta, stmtDeleteAllMeta, stmtDeleteOneMeta, stmtDeleteSomeMeta, stmtUpdateHonk *sql.Stmt

@@ -1176,6 +1176,7 @@ stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)")

stmtGetXonker = preparetodie(db, "select info from xonkers where name = ? and flavor = ?") stmtSaveXonker = preparetodie(db, "insert into xonkers (name, info, flavor, dt) values (?, ?, ?, ?)") stmtDeleteXonker = preparetodie(db, "delete from xonkers where name = ? and flavor = ? and dt < ?") + stmtDeleteOldXonkers = preparetodie(db, "delete from xonkers where flavor = ? and dt < ?") stmtRecentHonkers = preparetodie(db, "select distinct(honker) from honks where userid = ? and honker not in (select xid from honkers where userid = ? and flavor = 'sub') order by honkid desc limit 100") stmtUpdateFlags = preparetodie(db, "update honks set flags = flags | ? where honkid = ?") stmtClearFlags = preparetodie(db, "update honks set flags = flags & ~ ? where honkid = ?")
M web.goweb.go

@@ -2378,6 +2378,11 @@ var preservehooks []func()

func bgmonitor() { for { + when := time.Now().Add(-3 * 24 * time.Hour).UTC().Format(dbtimeformat) + _, err := stmtDeleteOldXonkers.Exec("pubkey", when) + if err != nil { + elog.Printf("error deleting old xonkers: %s", err) + } time.Sleep(50 * time.Minute) } }