Skip to content

Commit

Permalink
fix: Don't throw an exception if no pending licenses were found
Browse files Browse the repository at this point in the history
It seems plausible to me that this would occasionally happen as part of
the normal flow of things, so instead of alerting on-call just log a
warning.
  • Loading branch information
pwnage101 committed Jul 30, 2024
1 parent 30574c3 commit 4693622
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions license_manager/apps/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ def _batch_notify_or_remind_assigned_emails(
if len(pending_licenses) > allowed_batch_size:
raise Exception(f'Found more than {allowed_batch_size} licenses, no email sent to {action_type}')

if len(pending_licenses) == 0:
logger.warning(
f'{LICENSE_DEBUG_PREFIX} No pending licenses found for given emails, no email sent to {action_type}.'
)
return pending_licenses

enterprise_api_client = EnterpriseApiClient()
enterprise_customer = enterprise_api_client.get_enterprise_customer_data(
subscription_plan.enterprise_customer_uuid,
Expand Down

0 comments on commit 4693622

Please sign in to comment.