diff --git a/.talismanrc b/.talismanrc index afdcb43c01..b867c7b0f2 100644 --- a/.talismanrc +++ b/.talismanrc @@ -338,6 +338,6 @@ fileignoreconfig: - filename: tests/app/v3/notifications/test_rest.py checksum: f970efab73ad52e3e203fe0805925929033a72d9975ec1deb077331e9409f06f - filename: app/celery/scheduled_tasks.py - checksum: 0018c865e961c02090bffd4895a1e8c9e24d82468bd1bf24e699224f03a800d0 + checksum: aa7fa728bbced666a4de982dd04f4c670a363bf19dfd1cfc529c58113a906a24 - filename: app/notifications/send_notifications.py checksum: 0e995ae1bc466d9c90924e7a79a0b7473863d7922e946170a665488014472441 diff --git a/app/celery/scheduled_tasks.py b/app/celery/scheduled_tasks.py index 145c21bff7..e5fb0117dd 100644 --- a/app/celery/scheduled_tasks.py +++ b/app/celery/scheduled_tasks.py @@ -199,15 +199,10 @@ def check_templated_letter_state(): def _get_dynamodb_comp_pen_messages(table, message_limit: int) -> list: - try: - results = table.scan( - FilterExpression=boto3.dynamodb.conditions.Attr('processed').eq(False), - Limit=message_limit - ) - except Exception as e: - current_app.logger.error( - 'Exception trying to scan dynamodb table for send_scheduled_comp_and_pen_sms - %s', e) - return None + results = table.scan( + FilterExpression=boto3.dynamodb.conditions.Attr('processed').eq(False), + Limit=message_limit + ) current_app.logger.info('count of messages initially pulled from dynamodb Count=%s vs ScannedCount=%s', results.get('Count'), results.get('ScannedCount')) @@ -237,7 +232,7 @@ def _get_dynamodb_comp_pen_messages(table, message_limit: int) -> list: current_app.logger.info('current length of items from dynamodb len: %s', len(items)) # TODO test: can be removed after testing - current_app.logger.info('returning all items from dynamodb: %s', results.get('Items')) + current_app.logger.info('returning all items from dynamodb len: %s, items: %s', len(items), items) return items[:message_limit] @@ -270,7 +265,9 @@ def send_scheduled_comp_and_pen_sms(): comp_and_pen_messages = _get_dynamodb_comp_pen_messages(table, messages_per_min) except Exception as e: current_app.logger.error( - 'Exception trying to scan dynamodb table for send_scheduled_comp_and_pen_sms - %s', e) + 'Exception trying to scan dynamodb table for send_scheduled_comp_and_pen_sms exception_type: %s - ' + 'exception_message: %s', type(e), e + ) return # TODO test: can be removed after testing @@ -305,19 +302,20 @@ def send_scheduled_comp_and_pen_sms(): ) # call generic method to send messages - send_notification_bypass_route( - service_id=service_id, - template=template, - notification_type=SMS_TYPE, - # recipient=item.get('vaprofile_id'), # can this be vaprofile_id? maps to notification.to field - personalisation={'paymentAmount': item.get('paymentAmount')}, - sms_sender_id=None, - recipient_id={ - 'id_type': IdentifierType.VA_PROFILE_ID.value, - 'id_value': item.get('vaprofile_id') - }, - # api_key_type=KEY_TYPE_NORMAL - ) + # TODO commented out to test update + # send_notification_bypass_route( + # service_id=service_id, + # template=template, + # notification_type=SMS_TYPE, + # # recipient=item.get('vaprofile_id'), # can this be vaprofile_id? maps to notification.to field + # personalisation={'paymentAmount': item.get('paymentAmount')}, + # sms_sender_id=None, + # recipient_id={ + # 'id_type': IdentifierType.VA_PROFILE_ID.value, + # 'id_value': item.get('vaprofile_id') + # }, + # # api_key_type=KEY_TYPE_NORMAL + # ) # TODO test: can be removed after testing current_app.logger.info(