Commit Graph

5841 Commits

Author SHA1 Message Date
Rebecca Law
6c9fbcb4a0 Merge pull request #2271 from alphagov/fix-delete-query-for-bst
Added the limit to the query for the services with data retention.
2018-12-27 15:16:03 +00:00
Rebecca Law
941e14f71a Added the limit to the query for the services with data retention.
Also did a bit of refactoring.
2018-12-27 14:00:53 +00:00
Rebecca Law
39d6222e5a Merge pull request #2268 from alphagov/fix-delete-query-for-bst
Commit the deletes every 10,000 rows.
2018-12-21 14:16:45 +00:00
Rebecca Law
8e832a1178 Adding a log message 2018-12-21 14:09:29 +00:00
Rebecca Law
62a8076161 Commit the deletes every 10,000 rows. 2018-12-21 13:57:35 +00:00
Katie Smith
3ec50c4fac Merge pull request #2267 from alphagov/update-delete-notifications-query
Update delete notifications query
2018-12-21 10:02:58 +00:00
Katie Smith
af27caa99a Merge pull request #2266 from alphagov/log-message-fix
Fix log messages when emails and letters don't get deleted
2018-12-21 10:02:49 +00:00
Rebecca Law
67cffc22b6 Oops it missed the limit 2018-12-20 17:03:46 +00:00
Rebecca Law
d8a0a3f5ab Added a test to make sure the loop exits. 2018-12-20 17:02:49 +00:00
Rebecca Law
89923eab71 Updated the query to improve the performance.
The scheduled job for deleting emails has failed silently for many nights now.
2018-12-20 16:09:38 +00:00
Katie Smith
7d026ad385 wip 2018-12-20 12:31:00 +00:00
Katie Smith
a4f2880721 Fix log messages when emails and letters don't get deleted 2018-12-20 10:57:14 +00:00
Katie Smith
cb725babdf Merge pull request #2260 from alphagov/headers-to-template-preview
Send extra headers to Template Preview /precompiled/sanitise endpoint
2018-12-19 14:14:47 +00:00
Katie Smith
e9fb60f05c Send extra headers to Template Preview /precompiled/sanitise endpoint
We want to send two new headers, ServiceId and NotificationId to the
template preview /precompiled/sanitise endpoint. This is to allow us to log
errors from this endpoint in template preview with all the information needed,
instead of needing to pass the information back to notifications-api and
to log it there.
2018-12-19 13:49:27 +00:00
Pea (Malgorzata Tyczynska)
c87e95d7ff Merge pull request #2264 from alphagov/choose_postage
Add choose_postage service permission and add postage to Template
2018-12-18 10:31:11 +00:00
Leo Hemsted
3cf5902ca4 Merge pull request #2265 from alphagov/job-proccess-start
base job start of processing_started rather than created_at
2018-12-17 16:03:57 +00:00
Leo Hemsted
251aecab1b base job start of processing_started rather than created_at
otherwise scheduled jobs will be viewed as old, and we'll pull stats
from the statistics tables, even if they might have not even started
yet
2018-12-17 15:47:16 +00:00
Leo Hemsted
2bd4f74ad0 Merge pull request #2258 from alphagov/dashboard-jobs-speedup
stop dashboard reading notification_history
2018-12-17 14:52:06 +00:00
Pea Tyczynska
86c3d96a83 Test postage constraints on TemplateBase model 2018-12-17 10:38:09 +00:00
Pea Tyczynska
52a7dcf86c Add choose_postage service permission and add postage to Template 2018-12-14 18:12:26 +00:00
Chris Hill-Scott
6cf5eee485 Merge pull request #2263 from alphagov/npt-letter-logo
Add letter logo for Neath Port Talbot Council
2018-12-14 13:32:06 +00:00
Chris Hill-Scott
16311a8288 Add letter logo for Neath Port Talbot Council 2018-12-14 10:58:07 +00:00
Chris Hill-Scott
d692712b69 Merge pull request #2259 from alphagov/include-live-in-service-list
Include live/trial mode in list of services
2018-12-13 11:16:26 +00:00
Chris Hill-Scott
2f4f381fa4 Include live/trial mode in list of services
We need this so we can check in the admin whether users have any live
services.
2018-12-13 11:09:47 +00:00
Leo Hemsted
b80beab76c use ft_notification_status and notifications for job statistics
we previously always read from NotificationHistory to get the
notification status stats for a job. Now, if the job is more than three
days old read from ft_notification_status table, otherwise read from
the notifications table (to keep live updates).
2018-12-12 13:27:19 +00:00
Leo Hemsted
e555a7595b move job rest tests to use db.py instead of conftest directly 2018-12-12 12:59:55 +00:00
Leo Hemsted
63b3a3849f move job dao tests to use db.py instead of conftest directly 2018-12-12 12:59:55 +00:00
Leo Hemsted
bf62d3ad5f infer template/service from job for notification/ft_noti_status in db.py 2018-12-12 12:59:55 +00:00
Rebecca Law
4ddd38b440 Merge pull request #2257 from alphagov/add-index-to-notifications
New index for  notifications
2018-12-12 12:34:21 +00:00
Rebecca Law
4bb68c3e52 Merge pull request #2249 from alphagov/improve-performance-of-platform-admin-page
Improve performance of platform stats page
2018-12-12 12:20:13 +00:00
Rebecca Law
21a67556b8 Add an index on notifications for (service_id, created_at) to improve the performance of the notification queries.
We've already performed this update on production since you need to create the index concurrently, which is not allowed from the alembic script. For that reason we are checking if the index exists.
2018-12-12 12:14:49 +00:00
Pea (Malgorzata Tyczynska)
8b4655d8af Merge pull request #2255 from alphagov/switch_on_slow_goes_live
Switch providers on slow delivery goes live
2018-12-12 11:35:18 +00:00
Rebecca Law
852f1cbfe4 Merge pull request #2254 from alphagov/improve-performance-of-get-notifications-for-service
Remove the join to TemplateHistory.
2018-12-12 09:48:55 +00:00
Pea Tyczynska
af185adf4c Log the ratio of slow notifications 2018-12-11 15:28:38 +00:00
Pea Tyczynska
abe01c0bc0 Revert "Switch providers on slow delivery only produces logs"
This reverts commit 6938600ab8.
2018-12-11 15:14:08 +00:00
Rebecca Law
dfc12cc354 Remove the join to TemplateHistory.
We are adding an index to Notifications to optimize the get_notifications_for_service. We need to build the index concurrently which can not be run inside a transaction block so the index will need to be run on the db directly.

CREATE INDEX CONCURRENTLY ix_notifications_service_created_at ON notifications (service_id, created_at);
DROP INDEX CONCURRENTLY ix_notifications_service_created_at
2018-12-11 14:57:10 +00:00
Pea (Malgorzata Tyczynska)
d7fcd564e0 Merge pull request #2250 from alphagov/switch_providers_update
Update switch providers on slow delivery method and query
2018-12-11 10:27:29 +00:00
Pea Tyczynska
5ed7564066 Remove unused config variables
We don't use FUNCTIONAL_TEST_PROVIDER_SERVICE_ID or
UNCTIONAL_TEST_PROVIDER_SMS_TEMPLATE_ID anymore so we can safely
delete them from config and tests.
2018-12-10 17:25:53 +00:00
Rebecca Law
5b90fd6fb0 Removed unused method 2018-12-10 16:27:59 +00:00
Leo Hemsted
2d9609b1be Merge pull request #2253 from alphagov/folder-warning-msgs
template folder error messages
2018-12-10 15:51:44 +00:00
Leo Hemsted
474acc5bba new chillmaid approved error messages
these get shown on the front-end so make sure their content is good
2018-12-10 12:59:16 +00:00
Pea (Malgorzata Tyczynska)
ad3b0cabf7 Merge pull request #2251 from alphagov/update_serialize_for_csv
Add sender email and change date formatting on Notification's serialize_for_csv
2018-12-10 10:44:28 +00:00
Pea Tyczynska
9a76d6706e Update tests to match the new csv data 2018-12-07 11:24:15 +00:00
Pea Tyczynska
9ab6542678 Change created_at format for Notification serialize_for_csv
Change date formatting on serialize_for_csv so it is more
machine-readable while still remaining human-readable
2018-12-07 11:23:35 +00:00
Pea Tyczynska
a265871a42 Serialize Notification now also returns sender email address
sent_by_email_address field was added because sometimes two
people at one institution have the same name and then email
address, which is unique, is more useful.
2018-12-07 11:21:45 +00:00
Alexey Bezhan
4850d708fd Merge pull request #2248 from alphagov/disable-expensive-sqlalchemy-options
Disable unused SQLAlchemy configuration flags
2018-12-05 16:05:17 +00:00
Pea Tyczynska
6938600ab8 Switch providers on slow delivery only produces logs 2018-12-05 15:56:16 +00:00
Pea Tyczynska
418060fbdb Update switch provider on slow delivery task to change max once evey 10 minutes 2018-12-05 15:56:16 +00:00
Pea Tyczynska
39ca5b9525 New query for finding if provider is slow
The delivery for provider is slow if more than threshold (currently
we pass in threshold 10%) either took x (for now 4) minutes to deliver,
or are still sending after that time. We look at all notifications
for current provider which are delivered or sending, and are not under
test key, for the last 10 minutes.

We are using created_at to establish if notifications are from last
10 minutes because we have an index on it, so the query is faster.

Also write tests for new is_delivery_slow_for_provider query
2018-12-05 15:51:40 +00:00
Katie Smith
7e2353f497 Merge pull request #2247 from alphagov/add-endpoint-to-update-notification-status
Add endpoint to cancel letters
2018-12-05 15:19:04 +00:00