Hard daily cap, no-flood shutdown, ctx-aware poller, double-image fix
Four related fixes after Pete flooded a channel and ignored Ctrl-C: 1. Global daily cap (posting.daily_cap_total, default 5): hard ceiling on posts across ALL channels in a rolling 24h window. Checked before the per-channel min-interval and burst-cap. 2. Shutdown no longer flushes the queue. Previous drainAll posted every remaining item with rate limits disabled — which was literally the flood. Replaced with dropOnShutdown that clears queues and logs the count. 3. Poller respects ctx mid-loop. pollOnceWithErr now takes ctx and bails between items, so Ctrl-C doesn't have to wait for ~30s of network per pending story before shutdown can complete. 4. Double-image fix. PostStory now reports imageSent; the queue clears ImageURL before retry so a text-send failure after a successful image upload doesn't re-post the image.
This commit is contained in:
@@ -42,6 +42,9 @@ type PostingConfig struct {
|
||||
BurstCapCount int `yaml:"burst_cap_count"`
|
||||
BurstCapWindowSeconds int `yaml:"burst_cap_window_seconds"`
|
||||
DedupCooldownHours int `yaml:"dedup_cooldown_hours"`
|
||||
// DailyCapTotal is the hard global cap on posts across ALL channels in a
|
||||
// rolling 24-hour window. 0 disables the cap.
|
||||
DailyCapTotal int `yaml:"daily_cap_total"`
|
||||
}
|
||||
|
||||
type StorageConfig struct {
|
||||
|
||||
Reference in New Issue
Block a user