Commit 55e86001 authored by Birin Sanchez's avatar Birin Sanchez
Browse files

process_bundle_changes: Avoid crash when the user has no


subscriptions.
Select active users only.
Signed-off-by: Birin Sanchez's avatarBirin Sanchez <birin.sanchez@puri.sm>
parent 6f2791dc
Pipeline #18431 passed with stage
in 30 seconds
......@@ -130,7 +130,7 @@ def process_bundle_changes():
# We get all pending BundleChanges in reverse order ("-id") so we
# process the most recent ones earlier.
pending_changes = BundleChange.objects.filter(
is_pending=True).order_by('-id')
is_pending=True).filter(user__is_active=True).order_by('-id')
for pending_change in pending_changes:
is_active = False
......@@ -138,6 +138,11 @@ def process_bundle_changes():
# Check if the subscription is active
subs = get_user_subscriptions(pending_change.user)
if subs is None:
logger.info('User {} has no subscriptions. BundleChange cannot be '
'processed'.format(pending_change.user))
continue
for sub in subs:
order_id = sub.get('parent_id', -1)
sub_status = sub.get('status', '')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment