mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-16 07:31:14 -05:00
add tests for new sched task
This commit is contained in:
@@ -325,9 +325,9 @@ def run_letter_jobs():
|
||||
current_app.logger.info("Queued {} ready letter job ids onto {}".format(len(job_ids), QueueNames.PROCESS_FTP))
|
||||
|
||||
|
||||
@notify_celery.task(name="run-letter-notifications")
|
||||
@notify_celery.task(name="run-letter-api-notifications")
|
||||
@statsd(namespace="tasks")
|
||||
def run_letter_notifications():
|
||||
def run_letter_api_notifications():
|
||||
current_time = datetime.utcnow().isoformat()
|
||||
|
||||
notifications = dao_set_created_live_letter_api_notifications_to_pending()
|
||||
|
||||
@@ -230,8 +230,8 @@ class Config(object):
|
||||
'schedule': crontab(hour=5, minute=30),
|
||||
'options': {'queue': QueueNames.PERIODIC}
|
||||
},
|
||||
'run-letter-notifications': {
|
||||
'task': 'run-letter-notifications',
|
||||
'run-letter-api-notifications': {
|
||||
'task': 'run-letter-api-notifications',
|
||||
'schedule': crontab(hour=5, minute=40),
|
||||
'options': {'queue': QueueNames.PERIODIC}
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ def dao_set_created_live_letter_api_notifications_to_pending():
|
||||
the transaction so that if the task is run more than once concurrently, one task will block the other select
|
||||
from completing until it commits.
|
||||
"""
|
||||
return db.session.query(
|
||||
notifications = db.session.query(
|
||||
Notification
|
||||
).filter(
|
||||
Notification.notification_type == LETTER_TYPE,
|
||||
@@ -597,7 +597,7 @@ def dao_set_created_live_letter_api_notifications_to_pending():
|
||||
).all()
|
||||
|
||||
for notification in notifications:
|
||||
notification.notification_status = NOTIFICATION_PENDING
|
||||
notification.status = NOTIFICATION_PENDING
|
||||
|
||||
db.session.add_all(notifications)
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user