Expired pastes should release custom URLs (daily cleanup job) #29

Closed
opened 2026-09-09 01:46:16 +00:00 by poslop · 1 comment
Owner

Custom URLs should be freed when a paste expires. Additionally, custom URLs should be released one month after creation regardless. Implement as a daily cleanup job alongside the existing sweeper.

Custom URLs should be freed when a paste expires. Additionally, custom URLs should be released one month after creation regardless. Implement as a daily cleanup job alongside the existing sweeper.
Author
Owner

Implemented by Store.ReleaseCustomSlugs, called from the existing sweeper goroutine on every tick (production: every minute; the job itself is idempotent, so daily cadence is safe — tick interval injectable for tests).

Releases custom_slug when:

  • expires_at has passed (soft-deleted/expired pastes release immediately, no longer waiting for hard delete), or
  • created_at is more than 30 days old (custom URLs are a 30-day reservation, not permanent).

Log.Printf reports the count released. Tests cover: expired paste releases + slug reuse by new paste, 31-day-old paste releases, recent/unexpired pastes keep their slug, ticker-driven release. Note: no frontend changes needed.

Implemented by `Store.ReleaseCustomSlugs`, called from the existing sweeper goroutine on every tick (production: every minute; the job itself is idempotent, so daily cadence is safe — tick interval injectable for tests). Releases custom_slug when: - expires_at has passed (soft-deleted/expired pastes release immediately, no longer waiting for hard delete), or - created_at is more than 30 days old (custom URLs are a 30-day reservation, not permanent). Log.Printf reports the count released. Tests cover: expired paste releases + slug reuse by new paste, 31-day-old paste releases, recent/unexpired pastes keep their slug, ticker-driven release. Note: no frontend changes needed.
Sign in to join this conversation.