We don't show the sender addresses and letter branding on the settings page
if a service doesn't have letters enabled, so we should also hide the
postage for services that can't send letters.
(Postage can only be seen by Platform Admin users at the moment, but this will
change later).
We’ve learned of a change implemented today by the UK mobile
network operators, to stop allowing text message sender names
of 3 or less characters.
Adding this validation will not affect existing senders, only those
users trying to add to or update their senders.
According to gunicorn `timeout` docs, async workers shouldn't be
terminated after the request time exceeds the specified timeout
as long as the worker process is still communicating.
This makes sense for async workers since they generally don't
block other requests from processing.
This is the behaviour we've seen on notifications-api - requests
can sometimes take much longer than the default 30 second timeout
and still succeed.
For the admin app however gunicorn has been shutting down workers
after 30s with `[CRITICAL] WORKER TIMEOUT`. This results in a 502
response from the admin app. Most of these requests fail because
the underlying requests to the api is taking longer than 30 seconds,
however we haven't seen this in the logs originally since unlike
the admin app, api requests succeed (even though their response is
no longer needed).
This seems like a bug in newer versions of gunicorn, downgrading
it to the version that the api is currently using solves the problem
by allowing admin requests to take longer than 30 seconds.
(Tested by trying requests with a `time.sleep(30)` locally).
It's not clear what exactly the bug in gunicorn is, but this also
potentially unblocks eventlet workers and allows them to process
more than one request at a time.
Added a new row to the settings table, 'Post class', which shows the
default letter class of a service and is only visible to Platform Admin.
Also added a new page to enable Platform Admin users to change the
default letter class for a service - this only has two options at the
moment, 1st class only and 2nd class only.
When there is a uniqueness constraint on a DB column you can still have
multiple null values.
You can’t have multiple empty string values.
We are trying to save the domain as empty string when creating or
updating a new branding. This means that it’s currently not possible to
create or update a branding with no domain, because the uniqueness
constraint is violated.
For some reason we are getting pending back as a status from one of
our text message providers.
Because this is unrecognised by the admin app it shows up in the list of
messages as the raw status, styled like an error.
This commit maps it to sending instead, because the user doesn’t need to
know or care about the difference.