Add missing eagerloads

This commit is contained in:
Adrià Casajús 2024-10-31 14:39:43 +01:00
parent 68ef8ac43d
commit dc8c44e581
No known key found for this signature in database
GPG key ID: F0033226A5AFC9B9

12
cron.py
View file

@ -905,10 +905,14 @@ def check_mailbox_valid_pgp_keys():
def check_custom_domain(): def check_custom_domain():
# Delete custom domains that haven't been verified in a month # Delete custom domains that haven't been verified in a month
for custom_domain in CustomDomain.filter( for custom_domain in (
CustomDomain.verified == False, # noqa: E712 CustomDomain.filter(
CustomDomain.created_at < arrow.now().shift(months=-1), CustomDomain.verified == False, # noqa: E712
).yield_per(100): CustomDomain.created_at < arrow.now().shift(months=-1),
)
.enable_eagerloads(False)
.yield_per(100)
):
alias_count = Alias.filter(Alias.custom_domain_id == custom_domain.id).count() alias_count = Alias.filter(Alias.custom_domain_id == custom_domain.id).count()
if alias_count > 0: if alias_count > 0:
LOG.warn( LOG.warn(