Draft
Conversation
08a39e8 to
3b8a994
Compare
46e8757 to
2feb4fc
Compare
This changes the `send_letter` method of the `DVLAClient` to send the letter in a different way - by uploading the file before making the POST request. Currently, sending a letter is done in a single request to the `/v1/print/jobs` endpoint that includes the file. The new way of sending involves making 3 requests: 1. A GET request to `/v1/print/files/upload-url` to get a presigned URL 2. A PUT request to upload the letter file to the URL returned by step 1 3. A POST request to `/v1/print/jobs` with the `uploadId` from step 1 included in the request data These three requests are all made consecutively from the same method, which means we don't need to store the URL and uploadId from step 1 - they are used immediately. Any of the stages failing with a retryable error will result in the whole `deliver_letter` task being retried. It is possible for a letter to be uploaded successfully at stage 2, then a failure at stage 3 cause the task to retry and it to be uploaded again to a new presigned URL before being sent. If a letter is uploaded but there is no corresponding print request for the uploadId associated with the presigned URL, the file will not be sent by the DVLA and will get deleted. Error handling at the new stages of sending a letter Stage 1 - getting a presigned URL requires authentication so has the same error handling as making the POST request. Stage 2 - we don't handle the case of a URL having expired when uploading a file to it - URLs are valid for 1 hour and the delay between getting a new URL and using it is seconds at most. We treat rate limit errors (503s) from this endpoint like any other 5xx status code and retry. We don't expect to see rate limiting here because we'd hit rate limiting in stage 1 first.
2feb4fc to
a52b733
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.