Implement queue pruning and message rotation (closes #40) #67

Merged
sneak merged 6 commits from feat/queue-pruning into main 2026-03-10 15:37:34 +01:00

6 Commits

Author SHA1 Message Date
clawbot
e0eb38289e fix: use 'client output queue' terminology consistently
All checks were successful
check / check (push) Successful in 2m21s
Replace ambiguous 'queue' with 'client output queue' throughout
documentation, code comments, log messages, and error strings
added in the queue pruning PR.
2026-03-10 07:27:29 -07:00
0cc34fd7fb Merge branch 'main' into feat/queue-pruning
All checks were successful
check / check (push) Successful in 2m14s
2026-03-10 15:07:37 +01:00
clawbot
6f3c0b01b0 refactor: use Go duration strings for QUEUE_MAX_AGE and MESSAGE_MAX_AGE
All checks were successful
check / check (push) Successful in 5s
Change config from integer seconds to Go duration strings (e.g. '720h')
parsed via time.ParseDuration, consistent with SESSION_IDLE_TIMEOUT.
Default remains 30 days (720h).
2026-03-10 04:05:22 -07:00
clawbot
8d7a991587 refactor: 30-day defaults for all expiry settings
- QUEUE_MAX_AGE: 48h -> 30 days (per-client queue entry expiry)
- MESSAGE_MAX_AGE: replaces count-based MAX_HISTORY with time-based
  30-day message expiry
- SESSION_IDLE_TIMEOUT: 24h -> 30 days

All expiry is now time-based (30 days) as requested.

Closes #40
2026-03-10 04:05:22 -07:00
clawbot
291be0c701 fix: remove PruneOrphanedMessages to preserve history within MAX_HISTORY
PruneOrphanedMessages deleted messages that lost their client_queues
references after PruneOldQueueEntries ran, even when those messages
were within the MAX_HISTORY limit. This made MAX_HISTORY meaningless
for low-traffic channels.

RotateChannelMessages already caps messages per target. Queue pruning
handles client_queues growth. Orphan cleanup is redundant.

Closes #40
2026-03-10 04:05:22 -07:00
user
d57d5babf0 feat: implement queue pruning and message rotation
Enforce QUEUE_MAX_AGE and MAX_HISTORY config values that previously
existed but were not applied. The existing cleanup loop now also:

- Prunes client_queues entries older than QUEUE_MAX_AGE (default 48h)
- Rotates messages per target (channel/DM) beyond MAX_HISTORY (default 10000)
- Removes orphaned messages no longer referenced by any client queue

closes #40
2026-03-10 04:05:22 -07:00