Skip to content
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

[Hotfix] Remove index using created_at to prevent performance issue #451

Merged
merged 10 commits into from
Feb 21, 2024
3 changes: 3 additions & 0 deletions apps/core/management/scripts/portal_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def _get_new_url_and_save_to_s3(url, session):
hash = enc.hexdigest()[:20]
filename = f'files/portal_image_{hash}.{url.split("_")[-1]}'

if url.startswith("/board"):
url = str(BASE_URL) + url

r = session.get(url, stream=True, cookies=COOKIES)
if r.status_code == 200:
s3 = boto3.client("s3")
Expand Down
7 changes: 0 additions & 7 deletions apps/core/migrations/0057_alter_article_name_type_and_more.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,4 @@ class Migration(migrations.Migration):
verbose_name="익명 혹은 실명 여부",
),
),
migrations.AddIndex(
model_name="article",
index=models.Index(
fields=["created_at", "parent_board_id"],
name="created_at_parent_board_id_idx",
),
),
]
7 changes: 0 additions & 7 deletions apps/core/models/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,6 @@ class Meta(MetaDataModel.Meta):
verbose_name = "게시물"
verbose_name_plural = "게시물 목록"

indexes = [
models.Index(
fields=["created_at", "parent_board_id"],
name="created_at_parent_board_id_idx",
)
]

def __str__(self):
return self.title

Expand Down
Loading