From 58e9c4eb59a74067a3f9269b35d2f28b8d8f23e4 Mon Sep 17 00:00:00 2001 From: Her Email Date: Sat, 2 Dec 2023 15:25:17 -0500 Subject: [PATCH] tune migrations --- requirements-dev.txt | 2 +- takahe/management/commands/backfill_takahe.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 50a86089..836b8c33 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,4 +6,4 @@ djlint~=1.34.0 isort~=5.12.0 lxml-stubs pre-commit -pyright==1.1.336 +pyright==1.1.338 diff --git a/takahe/management/commands/backfill_takahe.py b/takahe/management/commands/backfill_takahe.py index a2b93f45..fe204fa3 100644 --- a/takahe/management/commands/backfill_takahe.py +++ b/takahe/management/commands/backfill_takahe.py @@ -1,3 +1,5 @@ +from datetime import datetime, timezone + from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.management.base import BaseCommand @@ -19,6 +21,8 @@ from users.models import User as NeoUser BATCH_SIZE = 1000 +TIMELINE_START = datetime.datetime(2023, 7, 1, tzinfo=timezone.utc) + def content_type_id(cls): return ContentType.objects.get(app_label="journal", model=cls.__name__.lower()).pk @@ -115,7 +119,7 @@ class Command(BaseCommand): published=post.published, ) ) - if post.visibility != 3: + if post.visibility != 3 and post.published > TIMELINE_START: for follower_id in followers[post.author_id]: events.append( TimelineEvent(