Ved 000 mns auth retry#1278
Ved 000 mns auth retry#1278amarauzoma wants to merge 2 commits intostaging/VED-16-mns-vacc-event-notificationsfrom
Conversation
|
This branch is working on a ticket in the NHS England VED JIRA Project. Here's a handy link to the ticket: VED-000 |
avshetty1980
left a comment
There was a problem hiding this comment.
Nice! some minor comments
dlzhry2nhs
left a comment
There was a problem hiding this comment.
Nice work, still a couple of things needed.
- Judging from Matt's PR, it looks like we could also remove the cache.py file in the
api_clientsdirectory. - This is our bad, I was meant to check Akin had actioned this, but it looks like we have 2 copies of
pds_get_patient_details. One in the ID Sync Lambda, which you've changed, but we also have one instance of it in thelambdas/shared/src/common/api_clients/get_pds_details.pyfile. @Akol125 should be able to pair up for it, if required, but recommend adjust so there is only one in shared and then the ID Sync Lambda also uses it. But as a minimum, we'll need to adjust the instance in shared, so it too uses the authenticator in the correct way. - We also need to adjust
mns_setupso it too instantiates the authenticator in the correct way.
You have some unit test and lint errors. Hopefully fixing the above will help with unit tests - I am happy to lend a hand if linting is still an issue.
- Finally, the key piece of work is to instantiate the MNS Service and PDS Service once within the new Lambda function. They should take separate authenticator instances for cleanliness (and because in future they would actually be using different secrets). At the moment, if you walk the mns publisher code, you will find we will be authenticating on every invocation of the Lambda function. This is not sustainable as - at least during working hours - several Lambdas should be going non-stop, so we want to reuse the authentication token and only refresh every 9-10 minutes to avoid too much pressure on the Apigee Auth service (not to mention the fact that it will be slow).
Tests may need adjusting to account for this e.g. not targeting the Lambda handler but the record processor for tests and injecting required values. Or, if you wanna test Lambda handler, mocking env vars at import time.
Again, hope this makes sense but happy to walk through this when I have some time if it doesn't.
|



Summary
Add any other relevant notes or explanations here. Remove this line if you have nothing to add.
Reviews Required
Review Checklist
ℹ️ This section is to be filled in by the reviewer.