Commit Graph

7178 Commits

Author SHA1 Message Date
Rebecca Law
b9441c528d Trying to find an efficient way to cycle the data 2020-05-04 17:39:13 +01:00
Rebecca Law
ed0aa61e27 Merge branch 'cycle-notification_history-table' of github.com:alphagov/notifications-api into cycle-notification_history-table 2020-05-04 15:18:57 +01:00
Rebecca Law
01bfcdead6 WIP 2020-05-04 15:18:04 +01:00
poveyd
37f5981de8 Update cycle_notification_history_in_batches.sql 2020-05-04 15:17:45 +01:00
Rebecca Law
8979e19ef3 Merge branch 'cycle-notification_history-table' of github.com:alphagov/notifications-api into cycle-notification_history-table 2020-05-04 13:36:28 +01:00
Rebecca Law
eede6dbda2 README that contains notes to create new manifest file 2020-05-04 13:35:35 +01:00
poveyd
da3b155ae8 Create cycle_notification_history_in_batches.sql 2020-05-04 12:18:25 +01:00
Rebecca Law
abe2555f31 Merge branch 'cycle-notification_history-table' of github.com:alphagov/notifications-api into cycle-notification_history-table 2020-04-30 12:13:23 +01:00
Rebecca Law
dd71db1844 Add a command to insert data into pivot table. 2020-04-30 12:12:48 +01:00
poveyd
3f2cc1df17 Update cycle_notification_history.sql 2020-04-28 15:42:38 +01:00
poveyd
42009beb0c Update cycle_notification_history.sql 2020-04-28 15:03:20 +01:00
Rebecca Law
67b03294e2 Script to add constraints and indexes. 2020-04-28 13:05:13 +01:00
poveyd
d6344d3370 Update cycle_notification_history.sql 2020-04-28 11:43:52 +01:00
poveyd
d087e17f7a Update cycle_notification_history.sql 2020-04-28 11:39:22 +01:00
poveyd
4303eba983 Update cycle_notification_history.sql 2020-04-28 11:21:11 +01:00
poveyd
5b4b238098 Update cycle_notification_history.sql 2020-04-28 10:21:51 +01:00
poveyd
cdbec816b3 Update cycle_notification_history.sql
Added a few steps
2020-04-28 10:20:13 +01:00
Rebecca Law
2d8c6ab494 This is a place to start creating scripts for maintaining the database. 2020-04-28 09:45:09 +01:00
Chris Hill-Scott
26793899d4 Merge pull request #2814 from alphagov/search-letters
Let users search for letters
2020-04-27 15:06:32 +01:00
Leo Hemsted
bd345d0390 Merge pull request #2818 from alphagov/restart-periodic-worker
restart reporting worker after each task
2020-04-27 11:03:07 +01:00
Leo Hemsted
1b8c683194 Merge pull request #2816 from alphagov/autoscaling-fixes
make create_letters_pdf always use right queue
2020-04-27 11:03:00 +01:00
David McDonald
985dddcfdc Merge pull request #2820 from alphagov/six-fragments
Bring in utils to bump max fragments to 6 for SMS
2020-04-24 16:11:58 +01:00
David McDonald
44155d4e7c Bring in utils to bump max fragments to 6 for SMS 2020-04-24 16:01:59 +01:00
Pea M. Tyczynska
6724b2cd74 Merge pull request #2817 from alphagov/update_healthcheck_page
Update _status page - remove references to Travis
2020-04-24 14:09:44 +01:00
Pea Tyczynska
260fd7940d Update healthcheck page - remove travis references
Also remove travis references from the repository
2020-04-24 13:43:00 +01:00
Leo Hemsted
ad419f7592 restart reporting worker after each task
The reporting worker tasks fetch large amounts of data from the db, do
some processing then store back in the database. As the reporting worker
only processes the create nightly billing/stats table tasks, which
aren't high performance or high volume, we're fine with the performance
hit from restarting the worker between every task (which based on
limited local testing takes about a second or so).

This causes some real funky shit with the app_context (used for
accessing current_app.logger). To access flask's global state we use the
standard way of importing `from flask import current_app`. However,
processes after the first one don't have the current_app available on
shut down (they're fine during the actual task running), and are unable
to call `with current_app.app_context()` to create it. They _are_ able
to call `with app.app_context()` to create it, where `app` is the
initial app that we pass in to `NotifyCelery.init_app`.

NotifyCelery.init_app is only called once, in the master process - I
think the application state is then stored and passed to the celery
workers. But then it looks like the teardown might clear it, but it
never gets set up again for the new workers? Unsure.

To fix this, store a copy of the initial flask app on the NotifyCelery
object and then use that from within the shutdown signal logging
function.

Nothing's ever easy ¯\_(ツ)_/¯
2020-04-24 12:28:25 +01:00
Chris Hill-Scott
64674be817 Make allowed notification types explicit in search
By not having a catch-all else, it makes it clearer what we’re
expecting. And then we think it’s worth adding a comment explaining why
we normalise as we do for letters and the `None` case.
2020-04-23 16:06:34 +01:00
Chris Hill-Scott
11008af96a Remove outdated comment 2020-04-23 15:35:25 +01:00
Leo Hemsted
d59b2f4cc9 make create_letters_pdf always use right queue
create-letters-pdf-tasks is for contacting template preview.
letters-tasks is for doing other things around letters (including putting things on template preview queue)
2020-04-22 16:07:51 +01:00
Chris Hill-Scott
9047b273da Save whole letter address into the to field
At the moment we’re not consistent:

Precompiled (API and one-off):
`to` has the whole address
`normalised_to` has nothing

Templated (API, CSV and one off):
`to` has the first line of the address
`normalised_to` has nothing

This commit makes us consistently store the whole address in the `to`
field. We think that people might want to search by postcode, not just
first line of the address.

This commit also starts to populate the normalised_to field with the
address lowercased and with all spaces removed, to make it easier to
search on.
2020-04-22 10:06:25 +01:00
Chris Hill-Scott
7897ae70ce Let users search for letters
Like we have search by email address or phone number, finding an
individual letter is a common task. At the moment users are having to
click through pages and pages of letters to find the one they’re looking
for.

We have to search in the `to` and `normalised_to` fields for now because
we’re not populating the `normalised_to` column for letters at the
moment.
2020-04-21 16:25:37 +01:00
Pea M. Tyczynska
d88b20beec Merge pull request #2813 from alphagov/firetext-check-code-on-failure-only
Check failure code on failure only.
2020-04-21 15:23:26 +01:00
Pea Tyczynska
9782cbc5b5 Check failure code on failure only.
We should check error code on failure only, because if we get an
error code on pending code, we should still set the notification
to pending status.
2020-04-21 13:43:45 +01:00
Pea M. Tyczynska
750a573afc Merge pull request #2812 from alphagov/firetext-000-code
Take into consideration Firetext 000 code - no error.
2020-04-21 12:21:36 +01:00
Pea Tyczynska
385d249787 Take into consideration Firetext 000 code - no error. Also change logs from error to warning 2020-04-21 12:06:28 +01:00
David McDonald
5011b5b8f5 Merge pull request #2811 from alphagov/request-time-monitoring
Add GDSMetrics package
2020-04-21 11:20:43 +01:00
Pea M. Tyczynska
850a56ab04 Merge pull request #2803 from alphagov/firetext-response-codes
Use firetext response code to see if temporary or permanent failure if available
2020-04-21 10:50:46 +01:00
David McDonald
1ff52bbaad Add GDSMetrics package
As per instructions https://github.com/alphagov/gds_metrics_python

The celery workers don't have an HTTP endpoint so no point in trying to
get prometheus to scrape them.
2020-04-20 18:39:45 +01:00
Pea Tyczynska
b962dcac5d Check Firetext code first to determine status and log the reason
If there is no code, fall back to old way of determining status.
If the code is not recognised, log an Error so we are notified
and can look into it.
2020-04-20 18:33:19 +01:00
Pea M. Tyczynska
69864611ef Merge pull request #2810 from alphagov/fix_preview
Fix bug where preview for templated letters would not show
2020-04-20 15:49:36 +01:00
Pea Tyczynska
7a89b1b835 Fix bug where preview for templated letters would not show 2020-04-20 15:35:37 +01:00
Katie Smith
c0343324c4 Merge pull request #2808 from alphagov/reset-providers
Restore provider resting points
2020-04-20 10:56:44 +01:00
Katie Smith
92c979fcdb Restore provider resting points
We temporarily updated the provider resting points in
https://github.com/alphagov/notifications-api/pull/2804.
This puts the provider resting points back to their original value now
that both providers seem to be functioning well.
2020-04-20 10:45:19 +01:00
Pea M. Tyczynska
d15db5702c Merge pull request #2807 from alphagov/make-sure-letter-personalisation-is-string
Make sure letter personalisation is string - pull utils patch
2020-04-17 18:29:17 +01:00
Pea Tyczynska
f27e544911 Make sure letter personalisation is string - pull utils patch 2020-04-17 13:42:57 +01:00
Chris Hill-Scott
47b5ae9dc1 Merge pull request #2801 from alphagov/use-new-utils-template-properties
Use new properties of utils Templates
2020-04-17 13:41:45 +01:00
Pea Tyczynska
fef03920f0 Add test for a callback with a code 2020-04-17 10:58:26 +01:00
Pea Tyczynska
470d00c26e Make comment clearer following review 2020-04-17 10:58:25 +01:00
Pea Tyczynska
a4507dbb3f Use firetext response code to see if temporary or permanent failure if available 2020-04-17 10:58:25 +01:00
Pea Tyczynska
91fe68eed4 WIP read firetext response codes 2020-04-17 10:58:25 +01:00