Implement thread pruning based on bumped_at
This commit is contained in:
@@ -17,11 +17,13 @@ var (
|
||||
|
||||
var CooldownMutex sync.Mutex
|
||||
|
||||
// const POST_COOLDOWN = 15 * time.Second
|
||||
const POST_COOLDOWN = 0 * time.Second
|
||||
const POST_COOLDOWN = 15 * time.Second
|
||||
|
||||
// const THREAD_COOLDOWN = 2 * time.Minute
|
||||
const THREAD_COOLDOWN = 0 * time.Minute
|
||||
// const POST_COOLDOWN = 0 * time.Second
|
||||
|
||||
const THREAD_COOLDOWN = 2 * time.Minute
|
||||
|
||||
// const THREAD_COOLDOWN = 0 * time.Minute
|
||||
|
||||
func IsOnCooldown(ip string, m map[string]time.Time, duration time.Duration) bool {
|
||||
CooldownMutex.Lock()
|
||||
|
||||
@@ -13,13 +13,13 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/dominicf2001/comfychan/internal/database"
|
||||
)
|
||||
|
||||
// 10 MB memory limit
|
||||
const FILE_MEM_LIMIT int64 = 10 << 20
|
||||
const POST_IMG_FULL_PATH = "web/static/img/posts/full"
|
||||
const POST_IMG_THUMB_PATH = "web/static/img/posts/thumb"
|
||||
const MAX_THREAD_COUNT = 50
|
||||
|
||||
func EnrichPost(body string) string {
|
||||
var b strings.Builder
|
||||
@@ -105,14 +105,6 @@ func SavePostFile(file *multipart.File, filename string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SumUniquePostIps(posts []database.Post) int {
|
||||
uniqueIpHashes := map[string]bool{}
|
||||
for _, post := range posts {
|
||||
uniqueIpHashes[post.IpHash] = true
|
||||
}
|
||||
return len(uniqueIpHashes)
|
||||
}
|
||||
|
||||
type PostImageInfo struct {
|
||||
Size int64
|
||||
Height int
|
||||
|
||||
Reference in New Issue
Block a user