Implement thread pruning based on bumped_at

This commit is contained in:
Dominic Ferrando
2025-04-21 14:00:10 -04:00
parent 997d65707c
commit 80a0a5eb89
4 changed files with 88 additions and 14 deletions
+9 -1
View File
@@ -30,6 +30,14 @@ func disableCacheInDevMode(next http.Handler) http.Handler {
})
}
func SumUniquePostIps(posts []database.Post) int {
uniqueIpHashes := map[string]bool{}
for _, post := range posts {
uniqueIpHashes[post.IpHash] = true
}
return len(uniqueIpHashes)
}
func main() {
// -----------------
// SETUP
@@ -244,7 +252,7 @@ func main() {
ThreadURL: fmt.Sprintf("/%s/threads/%d", slug, thread.Id),
MediaPath: op.MediaPath,
ReplyCount: len(posts),
IpCount: util.SumUniquePostIps(posts),
IpCount: SumUniquePostIps(posts),
})
}