Skip to content

Conversation

yasen-posthog
Copy link
Contributor

Problem

  • We currently have the refresh_activity_log_fields_cache task which runs every 12h to recalculate the filterable fields on the activity logs of large orgs (>20k records). However, this recalculates the whole cache from scratch. This doesn't make much sense because the log records are immutable and no new fields will be discovered if we keep recalculating on the same records.

Changes

  • Changes the task to recalculate on the last 14h only (runs each 12h + 2h buffer for delayed tasks).
  • Adds a --flushed and --hours-back to the python manage.py refresh_activity_log_fields_cache command which is a wrapper around the task code. Can be used to manually recalc the cache, incrementally or from scratch, and can be done on a custom timeframe if needed.

@yasen-posthog yasen-posthog requested a review from a team September 29, 2025 13:24
@yasen-posthog yasen-posthog self-assigned this Sep 29, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@yasen-posthog yasen-posthog merged commit 351bae9 into master Sep 30, 2025
182 of 183 checks passed
@yasen-posthog yasen-posthog deleted the yasen/feat/alog/incremental-cache-update branch September 30, 2025 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants