Skip to content

Commit

Permalink
comment out send notification
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanParish committed Nov 7, 2023
1 parent ff8aadf commit e88cac5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
46 changes: 22 additions & 24 deletions app/celery/scheduled_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit e88cac5

Please sign in to comment.