mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-13 00:32:16 -05:00
Add beat config for send-scheduled-notifications task to run every 15 minutes.
Added the missing commit to the update pending
This commit is contained in:
@@ -44,7 +44,7 @@ def run_scheduled_jobs():
|
||||
for job in dao_set_scheduled_jobs_to_pending():
|
||||
process_job.apply_async([str(job.id)], queue="process-job")
|
||||
current_app.logger.info("Job ID {} added to process job queue".format(job.id))
|
||||
except SQLAlchemyError as e:
|
||||
except SQLAlchemyError:
|
||||
current_app.logger.exception("Failed to run scheduled jobs")
|
||||
raise
|
||||
|
||||
@@ -58,8 +58,8 @@ def send_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:
|
||||
"Sent {} scheduled notifications to the provider queue".format(len(scheduled_notifications)))
|
||||
except SQLAlchemyError:
|
||||
current_app.logger.exception("Failed to send scheduled notifications")
|
||||
raise
|
||||
|
||||
|
||||
@@ -109,6 +109,11 @@ class Config(object):
|
||||
'schedule': crontab(minute=1),
|
||||
'options': {'queue': 'periodic'}
|
||||
},
|
||||
'send-scheduled-notifications': {
|
||||
'task': 'send-scheduled-notifications',
|
||||
'schedule': crontab(minute='*/15'),
|
||||
'options': {'queue': 'periodic'}
|
||||
},
|
||||
'delete-verify-codes': {
|
||||
'task': 'delete-verify-codes',
|
||||
'schedule': timedelta(minutes=63),
|
||||
|
||||
@@ -483,8 +483,9 @@ def dao_get_scheduled_notifications():
|
||||
|
||||
|
||||
def set_scheduled_notification_to_processed(notification_id):
|
||||
ScheduledNotification.query.filter(
|
||||
db.session.query(ScheduledNotification).filter(
|
||||
ScheduledNotification.notification_id == notification_id
|
||||
).update(
|
||||
{'pending': False}
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user