Add pending flag to scheduled_notifications.

Set pending flag to false when the notification has been sent to provider task.
This commit is contained in:
Rebecca Law
2017-05-22 15:07:16 +01:00
parent a57dc18895
commit 9bfba52f53
7 changed files with 38 additions and 4 deletions

View File

@@ -15,8 +15,8 @@ from app.dao.notifications_dao import (
delete_notifications_created_more_than_a_week_ago,
dao_timeout_notifications,
is_delivery_slow_for_provider,
dao_get_scheduled_notifications
)
dao_get_scheduled_notifications,
set_scheduled_notification_to_processed)
from app.dao.statistics_dao import dao_timeout_job_statistics
from app.dao.provider_details_dao import (
get_current_provider,
@@ -56,6 +56,7 @@ def send_scheduled_notifications():
scheduled_notifications = dao_get_scheduled_notifications()
for notification in scheduled_notifications:
send_notification_to_queue(notification, notification.service.research_mode)
set_scheduled_notification_to_processed(notification.id)
current_app.logger.info(
"Sent {} scheudled notifications to the provider queue".format(len(scheduled_notifications)))
except SQLAlchemyError as e: