Commit Graph
6543 Commits
Author SHA1 Message Date
Martyn Inglis 43a31fa497 Removed a stray sleep used for testing. 2017-04-05 15:33:02 +01:00
Martyn Inglis 72ecca4dab Added a 60 second timeout to the MMG and fire text clients.
- This is a CONNECT and a READ timeout.
- Gets wrapped in the standard client exception, with a status code of 504, message Gateway timeout.
- Is quiet noisy in logs to allow us to see it
- Ensures we flick across the provider.

To test change the timeout to 0 and it will timeout.
2017-04-05 15:31:37 +01:00
Rebecca Law c49217b1bf Update job status to ready to send, indicating the file for the job has been uploaded to S3. 2017-04-05 11:57:56 +01:00
Chris Hill-Scott 3783a449b7 Merge pull request #880 from alphagov/pass-contact-block
Pass through contact block from service to outputted letter
2017-04-05 09:45:28 +01:00
Rebecca Law 0506bc3b0c Updated the fetch_stats_by_date_range to return test notifications if the start and end date are with in the last 7 days.
If the date range is with the last 7 days we query Notifcations.
If the date range is outside of the last 7 days we query NotificationHistory.
NotificationHistory does not persist notifications created with a test api key.
2017-04-04 16:34:20 +01:00
Martyn Inglis 57bd6494e1 WIP - adding request timeout 2017-04-04 16:05:25 +01:00
Martyn Inglis b08ac6eb63 Ensure priority queue read by development machines. It's now a default queue in the config. 2017-04-04 13:53:01 +01:00
Martyn Inglis ac445114c7 When using a priority template put the notification in the priority queue.
- there is now a dedicated worker to handle priority queues. We don't now bundle this in the default worker.
2017-04-04 13:44:11 +01:00
Martyn Inglis 787d0da7db Broke the periodic queue out from the standard worker.
- now has own worker with worker count of 2
- this is too ensure that any issues with scheduled jobs do not affect core applications
2017-04-04 11:23:54 +01:00
Ken Tsang eef8aceac5 Refactored get utc in bst to use localize 2017-04-03 16:20:54 +01:00
Rebecca Law eee662e5be Make the code neater for the query. 2017-04-03 15:52:52 +01:00
Ken Tsang 2b53e14a73 Add fix for bst 2017-04-03 15:49:23 +01:00
Chris Hill-Scott e47a008dd9 Pass through contact block from service to letter
Whatever a user has entered for their service’s contact block should
appear in the right place in the file we give to DVLA.

The work to output in the right fields in the DVLA file has already been
done. We just weren’t passing it through. This commit passes it through.
2017-04-03 13:27:47 +01:00
Chris Hill-Scott c4c3268dd9 Use a simpler method of generating random number
Rather than generating each digit of the number, generate the whole
random number in one go. Should be faster, and is a bit easier to read.

Don’t need to worry about it not being zero-padded because the
`Template` class handles this here:
https://github.com/alphagov/notifications-utils/blob/6ddd2ff352b48aa534eba023574bb89dd037fde6/notifications_utils/template.py#L410
2017-04-03 13:25:22 +01:00
Chris Hill-Scott 7a412873d3 Refactor for better string concatenation
Using `+` to concatenate strings isn’t very memory efficient. Not sure
if there are real-world implications for how it’s being used here, but
can’t hurt to use `.join` instead.

Rewriting it as a generator also lets us remove some unneeded variable
assignment.
2017-04-03 13:23:33 +01:00
Martyn Inglis 8f5e1318eb Spread out the scheduled jobs.
Before the longer tasks all ran on the hour, at midnight, 1 and 2.

Now we run one at midnight, one at quarter past, half past then at quarter too. Trying to spread the load.
2017-04-03 11:17:27 +01:00
Leo Hemsted 1c4da5367f Can't set environs to nonetype 2017-03-31 17:10:43 +01:00
Ken Tsang d5e8cb3354 Updated cf conf unit tests 2017-03-31 16:50:30 +01:00
Ken Tsang 316d8fdb0d Updated config to cloudfoundry_config 2017-03-31 16:37:04 +01:00
Ken Tsang c633e193b0 Update config to enable performance platform 2017-03-31 15:54:29 +01:00
Ken Tsang 989713b0f1 Update config for daily perf job to start 4am 2017-03-31 15:33:41 +01:00
Rebecca Law 3838fb583c The redis cache for daily limits and template usage was being updated for notifications with a test api key.
This PR corrects that.
2017-03-30 13:43:44 +01:00
Martyn Inglis 7dcd3164e2 Revert "Reinstating the 2 task model for API submitted notifications."
This reverts commit 1c154c4113.
2017-03-30 10:46:23 +01:00
Martyn Inglis 9ee26e0b67 Revert "update notification rest tests"
This reverts commit 11919d9810.
2017-03-30 10:38:51 +01:00
Martyn Inglis 385a73da2b Revert "ensure we're passing through api keys and key types from notifications"
This reverts commit 25d1777937.
2017-03-30 10:38:41 +01:00
Ken Tsang 5f945ab30e Refactored code, changed now to utcnow in test 2017-03-29 11:47:41 +01:00
Ken Tsang c94b4f1b46 Removed unused import 2017-03-29 11:05:31 +01:00
Ken Tsang af78efd137 Fix get_detailed_services BST 2017-03-29 11:03:28 +01:00
kentsanggds 79025e54b0 Merge pull request #865 from alphagov/add-v2-template-preview
Add v2 template preview endpoint and schema
2017-03-28 18:40:32 +01:00
Leo Hemsted 11919d9810 update notification rest tests 2017-03-28 13:51:42 +01:00
Leo Hemsted 25d1777937 ensure we're passing through api keys and key types from notifications
when we made the change to async persist notifications, we forgot to
pass through api_key_id and key_type. in send_sms/email, for legacy
reasons, they default to None/KEY_TYPE_NORMAL, so regardless of what
your api key was set up as, we would send real messages!

TODO: Once the PaaS transition is complete and the task changes are
reverted, remove the api_key_id and key_type params from the send_*
tasks entirely, as those are only called from the csv job flow, and
don't need them
2017-03-28 13:14:46 +01:00
minglis d7adfcaf87 Merge pull request #866 from alphagov/no-downtime-hosting-migration
Reinstating the 2 task model for API submitted notifications.
2017-03-27 13:54:43 +01:00
Rebecca Law 37a5ce601a Update the version of notifications-utils.
There was a problem with the address block for the DVLATemplate.

Added a countdown to the build_dvla_file.
2017-03-24 15:25:02 +00:00
Ken Tsang dfaf38269b Refactored get template 2017-03-23 15:02:21 +00:00
Martyn Inglis 1c154c4113 Reinstating the 2 task model for API submitted notifications.
This is being done for the PaaS migration to allow us to keep traffic coming in whilst we migrate the database.

uses the same tasks as the CSV uploaded notifications. Simple changes to not persist the notification, and call into a different task.
2017-03-23 14:41:00 +00:00
Ken Tsang 50db538df7 Updated schema to remove redundant 'content' 2017-03-23 11:50:15 +00:00
Ken Tsang ecbe87a0d6 Added letter preview 2017-03-22 14:22:26 +00:00
Ken Tsang 22239deb90 Removed redundant try block 2017-03-22 14:01:04 +00:00
Ken Tsang 8e5266e89b Refactor and fix auth errors 2017-03-22 10:54:15 +00:00
Ken Tsang b81d789307 Add preview endpoint and tests 2017-03-22 10:11:31 +00:00
Ken Tsang fad67e1bdd Added schemas + tests & updated get template tests 2017-03-22 10:10:05 +00:00
bandesz 974b59a5b7 Add 'production' alias for live environment 2017-03-21 14:43:56 +00:00
Rebecca Law a4bb1f1f33 Merge pull request #861 from alphagov/secure-endpoints
Secure endpoints
2017-03-20 14:59:52 +00:00
Rebecca Law 34412eda9e Merge pull request #863 from alphagov/create-dvla-file
Added logging for any exception thrown in build_dvla_file
2017-03-17 17:37:17 +00:00
Rebecca Law 8225a57d50 reformat execption 2017-03-17 16:57:00 +00:00
Rebecca Law d831447329 re-raise execption 2017-03-17 16:33:51 +00:00
Rebecca Law a0ec8af7c9 Added logging for any exception thrown in build_dvla_file 2017-03-17 16:25:27 +00:00
Rebecca Law 37293b6c7a Added a test to ensure that all blueprints have a registered before_request method.
Added a test for the status endpoint.
2017-03-17 16:21:41 +00:00
Rebecca Law ad9effbe6e Merge pull request #862 from alphagov/create-dvla-file
Update statsd decorator so that it will log on error.
2017-03-17 14:57:59 +00:00
Rebecca Law 26576622b1 Only record the statsd timing on success. 2017-03-17 13:33:57 +00:00