mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 00:41:35 -05:00
Don't update older status in timeout notifications task
This commit is contained in:
@@ -411,7 +411,7 @@ def _timeout_notifications(current_statuses, new_status, timeout_start, updated_
|
|||||||
table.notification_type != LETTER_TYPE
|
table.notification_type != LETTER_TYPE
|
||||||
)
|
)
|
||||||
last_update_count = q.update(
|
last_update_count = q.update(
|
||||||
{'_status_enum': new_status, '_status_fkey': new_status, 'updated_at': updated_at},
|
{'status': new_status, 'updated_at': updated_at},
|
||||||
synchronize_session=False
|
synchronize_session=False
|
||||||
)
|
)
|
||||||
return last_update_count
|
return last_update_count
|
||||||
@@ -432,8 +432,8 @@ def dao_timeout_notifications(timeout_period_in_seconds):
|
|||||||
"""
|
"""
|
||||||
timeout_start = datetime.utcnow() - timedelta(seconds=timeout_period_in_seconds)
|
timeout_start = datetime.utcnow() - timedelta(seconds=timeout_period_in_seconds)
|
||||||
updated_at = datetime.utcnow()
|
updated_at = datetime.utcnow()
|
||||||
|
|
||||||
timeout = functools.partial(_timeout_notifications, timeout_start=timeout_start, updated_at=updated_at)
|
timeout = functools.partial(_timeout_notifications, timeout_start=timeout_start, updated_at=updated_at)
|
||||||
|
|
||||||
# Notifications still in created status are marked with a technical-failure:
|
# Notifications still in created status are marked with a technical-failure:
|
||||||
updated = timeout([NOTIFICATION_CREATED], NOTIFICATION_TECHNICAL_FAILURE)
|
updated = timeout([NOTIFICATION_CREATED], NOTIFICATION_TECHNICAL_FAILURE)
|
||||||
|
|
||||||
|
|||||||
@@ -157,13 +157,8 @@ def test_update_status_of_notifications_after_timeout(notify_api, sample_templat
|
|||||||
timeout_notifications()
|
timeout_notifications()
|
||||||
|
|
||||||
assert not1.status == 'temporary-failure'
|
assert not1.status == 'temporary-failure'
|
||||||
assert not1._status_fkey == 'temporary-failure'
|
|
||||||
|
|
||||||
assert not2.status == 'technical-failure'
|
assert not2.status == 'technical-failure'
|
||||||
assert not2._status_fkey == 'technical-failure'
|
|
||||||
|
|
||||||
assert not3.status == 'temporary-failure'
|
assert not3.status == 'temporary-failure'
|
||||||
assert not3._status_fkey == 'temporary-failure'
|
|
||||||
|
|
||||||
|
|
||||||
def test_not_update_status_of_notification_before_timeout(notify_api, sample_template):
|
def test_not_update_status_of_notification_before_timeout(notify_api, sample_template):
|
||||||
|
|||||||
Reference in New Issue
Block a user