mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Delete send-scheduled-notifications task
This was added a few years ago, but never used.
This commit is contained in:
@@ -25,8 +25,6 @@ from app.dao.jobs_dao import (
|
||||
)
|
||||
from app.dao.jobs_dao import dao_update_job
|
||||
from app.dao.notifications_dao import (
|
||||
dao_get_scheduled_notifications,
|
||||
set_scheduled_notification_to_processed,
|
||||
notifications_not_yet_sent,
|
||||
dao_precompiled_letters_still_pending_virus_check,
|
||||
dao_old_letters_with_created_status,
|
||||
@@ -62,21 +60,6 @@ def run_scheduled_jobs():
|
||||
raise
|
||||
|
||||
|
||||
@notify_celery.task(name='send-scheduled-notifications')
|
||||
@statsd(namespace="tasks")
|
||||
def send_scheduled_notifications():
|
||||
try:
|
||||
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 {} scheduled notifications to the provider queue".format(len(scheduled_notifications)))
|
||||
except SQLAlchemyError:
|
||||
current_app.logger.exception("Failed to send scheduled notifications")
|
||||
raise
|
||||
|
||||
|
||||
@notify_celery.task(name="delete-verify-codes")
|
||||
@statsd(namespace="tasks")
|
||||
def delete_verify_codes():
|
||||
|
||||
@@ -33,7 +33,6 @@ from app.models import (
|
||||
Notification,
|
||||
NotificationHistory,
|
||||
ProviderDetails,
|
||||
ScheduledNotification,
|
||||
KEY_TYPE_NORMAL,
|
||||
KEY_TYPE_TEST,
|
||||
LETTER_TYPE,
|
||||
@@ -652,26 +651,6 @@ def dao_created_scheduled_notification(scheduled_notification):
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@statsd(namespace="dao")
|
||||
def dao_get_scheduled_notifications():
|
||||
notifications = Notification.query.join(
|
||||
ScheduledNotification
|
||||
).filter(
|
||||
ScheduledNotification.scheduled_for < datetime.utcnow(),
|
||||
ScheduledNotification.pending).all()
|
||||
|
||||
return notifications
|
||||
|
||||
|
||||
def set_scheduled_notification_to_processed(notification_id):
|
||||
db.session.query(ScheduledNotification).filter(
|
||||
ScheduledNotification.notification_id == notification_id
|
||||
).update(
|
||||
{'pending': False}
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def dao_get_total_notifications_sent_per_day_for_performance_platform(start_date, end_date):
|
||||
"""
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user