all repos — honk @ d47ad2e5c84dd454781b698e8a979c568be3ab8d

my fork of honk

faster and simpler cleanup by deleting everything older than 30 days
Ted Unangst tedu@tedunangst.com
Fri, 31 May 2019 03:43:08 -0400
commit

d47ad2e5c84dd454781b698e8a979c568be3ab8d

parent

83a6e57302eac2a4e4ef3ff741bc25263d11aefd

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

jump to
M honk.gohonk.go

@@ -1335,7 +1335,8 @@ doordie(db, "delete from honks where userid = ? and convoy = ?", userid, t)

} } expdate := time.Now().UTC().Add(-30 * 24 * time.Hour).Format(dbtimeformat) - doordie(db, "update files set content = '', local = 0 where length(content) > 20000 and fileid in (select fileid from donks join honks on donks.honkid = honks.honkid where honks.dt < ? and whofore = 0) and fileid not in (select fileid from donks join honks on donks.honkid = honks.honkid where whofore = 2 or whofore = 3)", expdate) + doordie(db, "delete from donks where honkid in (select honkid from honks where dt < ? and whofore = 0)", expdate) + doordie(db, "delete from honks where dt < ? and whofore = 0", expdate) doordie(db, "delete from files where fileid not in (select fileid from donks)") }