Skip to content

Commit f823830

Browse files
authored
chore: reduce volume and frequency of batch updates (#18067)
1 parent 87c0b21 commit f823830

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

warehouse/accounts/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,6 @@ def includeme(config):
219219
# Add a periodic task to generate Account metrics
220220
config.add_periodic_task(crontab(minute="*/20"), compute_user_metrics)
221221
config.add_periodic_task(crontab(minute="*"), notify_users_of_tos_update)
222-
# TODO: After initial backfill, this can be done less frequently
223-
config.add_periodic_task(crontab(minute="*/5"), batch_update_email_domain_status)
222+
config.add_periodic_task(
223+
crontab(minute="0", hour=4), batch_update_email_domain_status
224+
)

warehouse/accounts/tasks.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,14 @@ def batch_update_email_domain_status(request: Request) -> None:
159159
stmt = (
160160
select(Email)
161161
.where(
162-
# TODO: After completely backfilled, remove the `or_` for None
163162
or_(
164163
Email.domain_last_checked.is_(None),
165164
Email.domain_last_checked < datetime.now(tz=UTC) - timedelta(days=30),
166165
)
167166
)
168167
.order_by(nullsfirst(Email.domain_last_checked.asc()))
169-
.limit(10_000)
168+
.limit(1_000)
170169
)
171-
# Run in batches to avoid too much memory usage, API rate limits
172-
stmt = stmt.execution_options(yield_per=1_000)
173170

174171
for email in request.db.scalars(stmt):
175172
update_email_domain_status(email, request)

0 commit comments

Comments
 (0)