Commit Graph

7170 Commits

Author SHA1 Message Date
Chris Hill-Scott
413d895707 Merge pull request #2020 from alphagov/pyup-update-pytz-2018.3-to-2018.4
Update pytz to 2018.4
2018-04-12 14:47:18 +01:00
Chris Hill-Scott
e3998e7db3 Reword request to go live message
We want to stop people writing support tickets that say something like
“I’ve just submitted a request to go live, how long does the process
take?”
2018-04-12 13:17:30 +01:00
Chris Hill-Scott
a322e994e0 Remove line about who can sign the agreement
It isn’t adding anything.
2018-04-12 13:12:35 +01:00
Chris Hill-Scott
b3a26c459a Merge pull request #2021 from alphagov/nhm.ac.uk
Add nhm.ac.uk to list of allowed domains
2018-04-11 12:24:21 +01:00
Chris Hill-Scott
2f96bcceba Merge pull request #2019 from alphagov/pyup-update-pytest-mock-1.8.0-to-1.9.0
Update pytest-mock to 1.9.0
2018-04-11 12:20:19 +01:00
Chris Hill-Scott
d7e91f2fd9 Add nhm.ac.uk to list of allowed domains
NHM is an executive non-departmental public body, sponsored by the Department for Digital, Culture, Media & Sport.

– https://www.gov.uk/government/organisations/natural-history-museum
2018-04-11 12:18:55 +01:00
Chris Hill-Scott
24dbe7b7b1 Add Redis cache between admin and API
Most of the time spent by the admin app to generate a page is spent
waiting for the API. This is slow for three reasons:

1. Talking to the API means going out to the internet, then through
   nginx, the Flask app, SQLAlchemy, down to the database, and then
   serialising the result to JSON and making it into a HTTP response
2. Each call to the API is synchronous, therefore if a page needs 3 API
   calls to render then the second API call won’t be made until the
   first has finished, and the third won’t start until the second has
   finished
3. Every request for a service page in the admin app makes a minimum
   of two requests to the API (`GET /service/…` and `GET /user/…`)

Hitting the database will always be the slowest part of an app like
Notify. But this slowness is exacerbated by 2. and 3. Conversely every
speedup made to 1. is multiplied by 2. and 3.

So this pull request aims to make 1. a _lot_ faster by taking nginx,
Flask, SQLAlchemy and the database out of the equation. It replaces them
with Redis, which as an in-memory key/value store is a lot faster than
Postgres. There is still the overhead of going across the network to
talk to Redis, but the net improvement is vast.

This commit only caches the `GET /service` response, but is written in
such a way that we can easily expand to caching other responses down the
line.

The tradeoff here is that our code is more complex, and we risk
introducing edge cases where a cache becomes stale. The mitigations
against this are:
- invalidating all caches after 24h so a stale cache doesn’t remain
  around indefinitely
- being careful when we add new stuff to the service response

---

Some indicative numbers, based on:
- `GET http://localhost:6012/services/<service_id>/template/<template_id>`
- with the admin app running locally
- talking to Redis running locally
- also talking to the API running locally, itself talking to a local
  Postgres instance
- times measured with Chrome web inspector, average of 10 requests

╲ | No cache | Cache service | Cache service and user | Cache service, user and template
-- | -- | -- | -- | --
**Request time** | 136ms | 97ms | 73ms | 37ms
**Improvement** | 0% | 41% | 88% | 265%

---

Estimates of how much storage this requires:

- Services: 1,942 on production × 2kb = 4Mb
- Users: 4,534 on production × 2kb = 9Mb
- Templates: 7,079 on production × 4kb = 28Mb
2018-04-10 12:58:35 +01:00
pyup-bot
a6e8e4979f Update pytz from 2018.3 to 2018.4 2018-04-10 11:56:30 +01:00
Pete Herlihy
7d6d15f07b Merge pull request #2018 from alphagov/183-209
183 - 209 and whatever it was to 75
2018-04-10 08:26:47 +01:00
pyup-bot
b41a42daf4 Update pytest-mock from 1.8.0 to 1.9.0 2018-04-10 04:27:16 +01:00
Pete Herlihy
f730cf30f5 183 - 209 and whatever it was to 75
* Juror Central Summoning Bureau - Online – HM Courts & Tribunals Service
* Richmond and Wandsworth Council – Richmond and Wandsworth Council
* ESFA feedback – Department for Education
* PINS Digital Service – Planning Inspectorate
* HMPO Belfast – Home Office
* food.gov.uk – Food Standards Agency
* NCC Mobile Team – Newcastle City Council
* Cambs CC Emergency planning – Cambridgeshire County Council
* HMPO Durham – Home Office
* HMPO London – Home Office
* HMPO Glasgow – Home Office
* HMPO Peterborough – Home Office
* HMPO Southport – Home Office
* Student Loans Company. Password Reset. – Student Loans Company
* DigITS – Crown Commercial Service
* Ofsted Reports Beta – Ofsted
* Revenue Accounts – Ministry of Housing, Communities & Local Government
* Luton Council - Electoral Registration – Luton Council
* Cael eich Pensiwn y Wladwriaeth – Department for Work and Pensions
* Warwick Crown Court – Ministry of Justice
* ProLive - Housing Repairs – Pembrokeshire County Council
* Wirral Council – Wirral Council
* DfT Bus Open Data – Department for Transport
* Paris File Watcher – Pembrokeshire County Council
* WFDC Electoral Services – Wyre Forest District Council
2018-04-09 15:15:08 +01:00
Chris Hill-Scott
45d1e024df Merge pull request #2016 from alphagov/pyup-update-pytest-mock-1.7.1-to-1.8.0
Update pytest-mock to 1.8.0
2018-04-09 13:55:31 +01:00
Chris Hill-Scott
4a9fa4e190 Merge pull request #2017 from alphagov/extra-hint-templates-go-live
Be clearer about the templates needed to go live
2018-04-09 13:53:25 +01:00
Chris Hill-Scott
44f42c8916 Be clearer about the templates needed to go live
Adding a ‘testing’ template it not enough. It needs to have some real
looking content, so that we can:
- work out what a service is doing
- assess whether that’s a reasonable (ie meeting the terms of use) thing
  to be doing with Notify

At the moment we’re having to go back to services quite a lot when they
request to go live and ask them for this stuff.
2018-04-09 13:40:03 +01:00
Chris Hill-Scott
8769a8e242 Merge pull request #2002 from alphagov/reword-agreement-download
[WIP] Reword the download agreement page
2018-04-09 11:12:08 +01:00
Chris Waszczuk
4f208ef849 Merge pull request #2010 from alphagov/one-off-fixxx
Add pagination to inbox page
2018-04-09 10:30:24 +01:00
pyup-bot
b4dca35430 Update pytest-mock from 1.7.1 to 1.8.0 2018-04-07 05:12:14 +01:00
Chris Hill-Scott
5723c86ebe Merge pull request #2015 from alphagov/gt-button
Fix missing `>` in delete confirmation
2018-04-06 15:32:12 +01:00
Chris Hill-Scott
158822a4d9 Fix missing > in delete confirmation
It’s messing up the layout of the page
2018-04-06 15:11:36 +01:00
Chris Hill-Scott
b39709f0da Merge pull request #2013 from alphagov/wyreforestdc.gov.uk
Note agreement signed by Wyre Forest DC
2018-04-06 11:06:08 +01:00
Chris Hill-Scott
4e1d1fe62a Note agreement signed by Wyre Forest DC 2018-04-06 10:56:39 +01:00
Chris Hill-Scott
efbf9c55fb Merge pull request #2011 from alphagov/spacing-templates-page
Even out spacing on templates page
2018-04-05 16:42:25 +01:00
Chris Hill-Scott
39236cd9bb Merge pull request #2012 from alphagov/innovateukgovuk
Add Innovate UK to list of domains
2018-04-05 16:42:16 +01:00
Chris Hill-Scott
2eebb654c6 Add Innovate UK to list of domains
They are a non-crown body, they haven’t signed the agreement yet.
2018-04-05 16:35:01 +01:00
Chris Hill-Scott
fccd4367e4 Even out spacing on templates page
…when search box is present
2018-04-05 14:55:02 +01:00
chrisw
78d16709d6 reading messages for inbox from new most_recent endpoint
avoids us having to work out and display most recent messages
only on the front-end - it's now all done in api
2018-04-05 13:54:37 +01:00
Chris Hill-Scott
61b4f9a13c Merge pull request #2009 from alphagov/template-id-back-in-session
Make send test letter preview use template ID
2018-04-05 09:51:43 +01:00
Chris Hill-Scott
0b905249a7 Make send test letter preview use template ID
The check page expects template ID to be passed through in the URL not
the session now. The send test letter page wasn’t changed.

This commit changes it, and adds a test to make sure this path is
covered.
2018-04-04 17:10:22 +01:00
chrisw
1d32c766e8 remove X messages from Y users msg 2018-04-04 15:43:07 +01:00
chrisw
f5c467e4ff add pagination to inbox page 2018-04-04 15:41:17 +01:00
Chris Hill-Scott
bf58a4347b Merge pull request #2008 from alphagov/template-id-back-in-session
Put template_id back in the session
2018-04-04 15:36:30 +01:00
Chris Hill-Scott
b2722a0cd7 Put template_id back in the session
The start job endpoint needs the template ID in order to make the API
call.

It doesn’t make sense to add it to the start job URL, because users
could potentially start a job with the wrong template by hacking the URL
(which would blow up at some point, if the template didn’t match the
columns in the file).
2018-04-04 15:28:30 +01:00
Rebecca Law
fc846cf4a2 Merge pull request #2001 from alphagov/store-less-in-session
Stop storing `template_id` and `original_file_name` in session
2018-04-04 14:42:38 +01:00
Rebecca Law
c4fde48c53 Merge pull request #2005 from alphagov/3-years
Limit number of navigable financial years to 3
2018-04-04 14:42:19 +01:00
Chris Waszczuk
b1196373c8 Merge pull request #2007 from alphagov/revert-1985-add-pagination-to-inbox-page
Revert "add pagination to inbox page"
2018-04-04 14:30:23 +01:00
Chris Waszczuk
6153389e01 Revert "add pagination to inbox page" 2018-04-04 14:18:03 +01:00
Chris Waszczuk
628d8ac5a8 Merge pull request #1985 from alphagov/add-pagination-to-inbox-page
add pagination to inbox page
2018-04-04 13:15:29 +01:00
Chris Waszczuk
59c83cd78e Merge pull request #2004 from alphagov/session-size-stuff
remove any old file upload data on sign in
2018-04-04 13:15:02 +01:00
Chris Hill-Scott
ba9935c49e Remove ‘check’ page’s reliance on session
A of this commit’s parent we are storing `template_id` and
`original_file_name` in the URL. Getting them from the URL is better,
so the check page no longer needs to look for them in the session. This
commit removes the code that looks for these values in the session.
2018-04-04 11:37:43 +01:00
Chris Hill-Scott
3dab34cd38 Store template ID and original file name in URL
At the moment you can’t press refresh on the check page if there’s
errors. This is because the session gets cleared when there’s errors.
This is a bad user experience.

The data that this page is relying on (from the session) is:
- template ID
- original file name

Neither of these things need to be in the session because:
- they are not secret
- the user can modify them already (by choosing a different template or
  renaming their file locally)

So this commit additionally stores them in the URL.
2018-04-04 11:30:27 +01:00
Chris Hill-Scott
2e795be2a7 Merge pull request #2006 from alphagov/sfc
Remove learning and skills council from domains
2018-04-04 09:56:49 +01:00
Chris Hill-Scott
25ce8f3c4a Remove learning and skills council from domains
Because:
- they’re not a council
- they don’t exist any more (part of SFA, which has become ESFA)
2018-04-04 09:50:17 +01:00
Chris Hill-Scott
d75f89daf5 Limit number of navigable financial years to 3
Because more than 3 looks ugly.
2018-04-03 18:13:38 +01:00
Leo Hemsted
0dabd4ffc0 remove any old file upload data on sign in
if a user signs in again, clear their file upload data from any
aborted journeys from before, so that their cookies don't fill up

also add some temporary logging when the session starts getting full.
2018-04-03 14:58:50 +01:00
Chris Hill-Scott
146bb3284e Merge pull request #2003 from alphagov/bump-utils-askterisks
Bump utils to 25.2.3
2018-04-03 13:07:49 +01:00
chrisw
50661faac0 add pagination to inbox page 2018-04-03 12:12:30 +01:00
Chris Hill-Scott
53556ee56b Bump utils to 25.2.3 2018-04-03 12:08:59 +01:00
Chris Hill-Scott
8fb909101b Reword the download agreement page 2018-04-03 10:58:48 +01:00
Rebecca Law
98a40ac55b Merge pull request #2000 from alphagov/reduce-ajax-request-per-second
Reduce ajax call interval
2018-03-29 15:49:36 +01:00
Rebecca Law
0d23c87599 In an attempts to reduce the traffice this pull request changes the interval the ajax calls to 5 seconds from 2 seconds for the dashboad page. 2018-03-29 15:42:19 +01:00