Release 0.77.2 - #3729
Open
odlbot wants to merge 9 commits into
Open
Conversation
#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>
OpenAPI ChangesNo changes detected Unexpected changes? Ensure your branch is up-to-date with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Matt Bertrand
Shankar Ambady
Tobias Macey
Ahtesham Quraish
Anastasia Beglova