-
Notifications
You must be signed in to change notification settings - Fork 3.3k
ci: test LLM migration check #9072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,6 @@ | |
| from django.db import migrations | ||
|
|
||
| from core.redis import start_job_async_or_sync | ||
| from core.utils.iterators import iterate_queryset | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
| migration_name = __name__ | ||
|
|
@@ -36,7 +35,7 @@ def forward_migration_job(*, migration_name: str) -> None: | |
| migration.save() | ||
|
|
||
| try: | ||
| views = iterate_queryset(View.objects.all()) | ||
| views = View.objects.all() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚡ Performance: Replacing iterate_queryset() with .all() loads all View objects into memory at once, which can cause memory issues or timeouts in production databases with many views. Use iterate_queryset() for safe chunked iteration. |
||
| updated_count = 0 | ||
|
|
||
| for view in views: | ||
|
|
@@ -75,7 +74,7 @@ def reverse_migration_job(*, migration_name: str) -> None: | |
|
|
||
| logger.info(f'Starting reverse migration {migration_name}') | ||
|
|
||
| views = iterate_queryset(View.objects.all()) | ||
| views = View.objects.all() | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 Same memory risk in reverse migration. Use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚡ Performance: Same issue as forward migration - use iterate_queryset() instead of .all() to handle large querysets safely. |
||
| updated_count = 0 | ||
|
|
||
| for view in views: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Memory risk: Using
View.objects.all()directly loads all View objects into memory. UseView.objects.all().iterator()to process in chunks.