Add missing eager load for apple

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

10
cron.py
View file

@ -286,9 +286,13 @@ def notify_manual_sub_end():
def poll_apple_subscription():
"""Poll Apple API to update AppleSubscription"""
for apple_sub in AppleSubscription.filter(
AppleSubscription.expires_date < arrow.now().shift(days=15)
).yield_per(100):
for apple_sub in (
AppleSubscription.filter(
AppleSubscription.expires_date < arrow.now().shift(days=15)
)
.enable_eagerloads(False)
.yield_per(100)
):
if not apple_sub.is_valid():
# Subscription is not valid anymore and hasn't been renewed
continue