Lifecycle

Decay, hiding, and cleanup

Scores decay exponentially to hide stale items before deleting them. Low-touch events shrink fastest.

Scheduler Hourly

Event score decay

Every hour APScheduler runs run_decay_cycle, which walks events in batches (200 at a time) and applies an exponential drop to score based on days since it was last opened.

new_score = current_score * (decay_factor ** elapsed_days)
  • Default decay_factor is 0.92/day; recently viewed events (last_accessed) decay slower than idle ones.
  • Events are kept in the decay loop if their score is above the delete threshold or they are newer than delete_after_days.
  • Deletion is only considered after the event starts and its end time plus a grace window has passed (default 30 days).
  • After decay, items older than delete_after_days with a score at/below the delete threshold are purged once the grace window expires.

Visibility and deletion rules

Score controls whether an event appears in listings before it is deleted outright.

  • Listings show events whose score is above the hide threshold, or anything created in the last hide_after_days (defaults: 10 and 7).
  • Deletion requires both age (delete_after_days, default 30) and low score (delete_threshold, default 2), and it waits for the event to end plus the grace window (delete_grace_days_after_end, default 30).
  • Upcoming events are skipped entirely when deciding deletions.
  • Nothing is restored after purge; RSVPs tied to the event are removed with it.

Scores update when visitors view events via the UI or GET /api/v1/events/{id}, because that touch refreshes last_accessed.

Channel lifecycle

Channels decay the same way, using last_used_at (bumped when events are created or opened).

  • Exponential decay reuses the same factor/thresholds as events.
  • Channels below the delete threshold disappear only when empty; active events keep a channel alive.
  • Private/public visibility does not affect decay, only listings.

Controls & tuning

Configuration lives in openrsvp.toml (override with OPENRSVP_CONFIG) and can be edited via CLI:

openrsvp config --show
openrsvp config --delete-grace-days-after-end 45 --decay-factor 0.9

Environment variables still override file values when set.

  • OPENRSVP_EVENTS_PER_PAGE & OPENRSVP_ADMIN_EVENTS_PER_PAGE control pagination sizes.
  • OPENRSVP_SEED_CHANNELS, OPENRSVP_SEED_EVENTS_PER_CHANNEL, OPENRSVP_SEED_EXTRA_EVENTS, OPENRSVP_SEED_RSVPS_PER_EVENT, OPENRSVP_SEED_PRIVATE_PERCENT, OPENRSVP_SEED_PRIVATE_RSVP_PERCENT tune the seed-data command defaults.
  • OPENRSVP_ENABLE_SCHEDULER toggles APScheduler (decay/vacuum) for environments that run it externally.
  • OPENRSVP_INITIAL_EVENT_SCORE and OPENRSVP_INITIAL_CHANNEL_SCORE set starting scores for new records.
  • OPENRSVP_DECAY_FACTOR (default 0.92), OPENRSVP_DECAY_INTERVAL_HOURS (default 1)
  • OPENRSVP_HIDE_THRESHOLD (10) & OPENRSVP_HIDE_AFTER_DAYS (7)
  • OPENRSVP_DELETE_THRESHOLD (2), OPENRSVP_DELETE_AFTER_DAYS (30), and OPENRSVP_DELETE_GRACE_DAYS_AFTER_END (30)
  • OPENRSVP_PROTECT_UPCOMING_EVENTS defaults to true so future events never purge.
  • OPENRSVP_VACUUM_HOURS (12) schedules SQLite VACUUM alongside decay.

Use openrsvp decay to trigger a cycle manually; add --vacuum to run SQLite cleanup right after.