Repository navigation
Resume uploads correctly after HTTP errors - #220
Conversation
chrisdebian
left a comment
There was a problem hiding this comment.
Hi Ozcan,
I've been through this with Claude Code and checked the results myself. The fix looks right to me. All 121 tests pass, and with the old upload code put back, 10 of the 16 tests in the two upload test files fail, so they do catch the bug. I only used a mock server, so I'm relying on your Node route checks for the real one.
One thing you may want to look at before 3.0.7. It isn't caused by this change, but the change makes it much easier to reach. When a folder upload now fails for good (a 403, say, or after the retries run out), upload() in upload.py catches the error and returns {'Success': False, ...}, and __main__.py ignores that. From reading the code, the user gets no final error message and a normal exit. The finally block also deletes mapilio_image_description.json, so they may have to process the images again. I confirmed the return value and the deleted file with a mock server, but didn't run the full command. Uploading a zip file does report the error.
Three smaller things, none of them blocking:
- If the final empty request gets a 204 or a non-JSON reply, the loop still never ends. Your server may never answer that way.
- A 429 now stops the upload instead of retrying, unless the body sets
retriable. - The upload requests have no timeout, so a stalled connection could hang without ever reaching the retry code.
I'm happy to send a small PR for the silent failure if that would help, or to leave it with you.
Thanks, Chris
|
Merged this fix. I checked the folder-upload path too: the failure result is ignored and the description file is removed in Please send the small follow-up for a visible error, non-zero CLI exit and keeping the metadata after failure. We'll hold 3.0.7 for that. The timeout, 429 and unexpected completion replies can be separate follow-ups. |
|
I've picked up the completion-response loop separately in #221. Your folder-upload follow-up can stay focused on reporting the failure and preserving metadata. |
Let HTTP errors reach the existing retry code, which fetches the server offset again before resuming. This prevents skipped chunks and the tight loop after a failed request.
121 tests pass, including retries when the failed chunk was already stored. Eight local checks also pass through the actual Node upload route. AI assistance was used for implementation and review.
Fixes #218.