mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
remove jobs from letter api calls
we now no longer create a job. At the end of the post there is no action, as we don't have any tasks to queue immediately - if it's a real notification it'll get picked up in the evening scheduled task. If it's a test notification, we create it with an initial status of sending so that we can be sure it'll never get picked up - and then we trigger the update-letter-notifications-to-sent-to-dvla task to sent the sent-at/by.
This commit is contained in:
@@ -477,16 +477,18 @@ def dao_update_notifications_for_job_to_sent_to_dvla(job_id, provider):
|
||||
@transactional
|
||||
def dao_update_notifications_by_reference(references, update_dict):
|
||||
now = datetime.utcnow()
|
||||
updated_count = Notification.query().filter(
|
||||
updated_count = Notification.query.filter(
|
||||
Notification.reference.in_(references)
|
||||
).update(
|
||||
update_dict
|
||||
update_dict,
|
||||
synchronize_session=False
|
||||
)
|
||||
|
||||
NotificationHistory.query().filter(
|
||||
NotificationHistory.query.filter(
|
||||
NotificationHistory.reference.in_(references)
|
||||
).update(
|
||||
update_dict
|
||||
update_dict,
|
||||
synchronize_session=False
|
||||
)
|
||||
|
||||
return updated_count
|
||||
@@ -585,11 +587,12 @@ def dao_set_created_live_letter_api_notifications_to_pending():
|
||||
from completing until it commits.
|
||||
"""
|
||||
return db.session.query(
|
||||
Notification.id
|
||||
Notification
|
||||
).filter(
|
||||
Notification.notification_type == LETTER_TYPE,
|
||||
Notification.status == NOTIFICATION_CREATED,
|
||||
Notification.key_type == KEY_TYPE_NORMAL,
|
||||
Notification.api_key != None
|
||||
).with_for_update(
|
||||
).all()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user