Skip to content

Commit

Permalink
Merge pull request #451 from sparcs-kaist/hotfix/article-index-change
Browse files Browse the repository at this point in the history
[Hotfix] Remove index using created_at to prevent performance issue
  • Loading branch information
injoonH committed Feb 21, 2024
2 parents c73f252 + 9c9fc80 commit 14bdb10
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
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

0 comments on commit 14bdb10

Please sign in to comment.