Skip to content

Release 0.77.2 - #3729

Open
odlbot wants to merge 9 commits into
releasefrom
release-candidate
Open

Release 0.77.2#3729
odlbot wants to merge 9 commits into
releasefrom
release-candidate

Conversation

@odlbot

@odlbot odlbot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Matt Bertrand

Shankar Ambady

Tobias Macey

Ahtesham Quraish

Anastasia Beglova

abeglova and others added 9 commits August 4, 2026 15:06
#3719)

* added a fallback to populate run readable ids for contentfiles without runs

* scope filter better
…age folder (#3706)

Co-authored-by: Ahtesham Quraish <ahtesham.quraish@A006-01455.local>
…unt() (#3711)

* Sort learning resources by denormalized view_count, not live Count()

sortby=-views annotated the queryset with Count("views"), forcing a
full join + aggregate across learning_resources_learningresourceviewevent
on every unauthenticated list request. Because the queryset also carried
.distinct(), pagination's get_count() re-ran the same aggregate a second
time per page. Repeated pagination against this endpoint drove
ol-mitlearn-db-production into disk saturation (see #3710
for full incident detail: DiskQueueDepth spiked from 0.012 to 126,
WriteThroughput hit 405 MB/s against a 500 MB/s gp3 cap).

LearningResource.view_count already exists and is updated per-resource
by the PostHog ETL, so order directly on that column instead. NULLs
(unpopulated / zero-view resources) are placed last for -views and
first for views.

calculate_view_counts previously had no scheduled trigger, so add a
daily beat task wrapping update_resource_view_counts() to keep the
column populated for resources the per-event ETL path doesn't touch.

Closes #3710

* Address PR review feedback: cache invalidation, schedule collision, initial backfill

- calculate_resource_view_counts now clears the anonymous views cache
  after updating view_count, so the API doesn't keep serving stale
  ordering/values for up to the cache TTL after the task runs
  (copilot-pull-request-reviewer).
- Stagger the new beat schedule to 04:20 UTC; it previously collided
  with cleanup-deleted-content-files at 04:00 UTC
  (copilot-pull-request-reviewer).
- Add a one-time data migration that runs update_resource_view_counts()
  at deploy time, closing the gap where already-viewed resources would
  sort as least-popular (NULL view_count) until the next scheduled
  backfill run (sentry, copilot-pull-request-reviewer).

* Drop scheduled view_count backfill per review — posthog ETL already keeps it fresh

learning_resources/etl/posthog.py:173 already recalculates and saves
view_count for every resource that receives a new view event on each
update_posthog_events run (every 3h). A separate scheduled recalculation
task is therefore redundant with the ETL's own incremental update, not
a correctness fix — the existing calculate_view_counts management
command already covers the "column is broken, needs a manual
repopulate" case this was meant to guard against.

Removes the calculate_resource_view_counts Celery task, its beat
schedule entry, its test, and the one-time backfill data migration
added in a prior round to compensate for it. The core fix — ordering
by the view_count column instead of a live Count() aggregate — is
unaffected.
* added course code and proper markdown formatting

* add tests

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* call course code etc course number

* fix tests

* fix tests

* test fix

* switch to using course number json if populated

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants