Repository navigation
fix(backend): treat any 2xx upload reply as delivered - #108
Merged
Merged
Conversation
- a non-JSON or incomplete 2xx reply no longer raises, so the queue does not retry and the backend does not store the capture twice - UploadedImageInfo.image_id is optional; BackendPushSink falls back to the local capture id - upload_preview_thumbnail still raises when the reply has no usable URL Signed-off-by: Simon van Lierde <simonvanlierde@gmail.com>
Merging this PR will not alter performance1 warning
Comparing |
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.
This stops the Pi from uploading a capture twice when the backend accepts it but sends back an odd reply.
upload_imageraisedBackendUploadErroron a 2xx reply that was not JSON or lackedimage_id/image_url, so the queue retried and the backend stored the capture again. Only a badimage_urlwas handled.UploadedImageInfocarriesNonefor the unusable parts (image_idis nowstr | None).BackendPushSink.putfalls back to the local capture id when the backend id is missing, soStoredImage.image_idand the capture response always have an id.upload_preview_thumbnail(which needs its URL) still raise.Tests: new unit tests for a non-JSON 2xx, a 2xx missing fields and the sink fallback; the first two failed with
BackendUploadErrorbefore the change.just checkrun, 916 passed, 1 skipped.