fix(web): apply retry handlers to files_upload_v2 file POST - #1941
Open
DSeaStar wants to merge 1 commit into
Open
fix(web): apply retry handlers to files_upload_v2 file POST#1941DSeaStar wants to merge 1 commit into
DSeaStar wants to merge 1 commit into
Conversation
The getUploadURLExternal and completeUploadExternal steps already go through api_call(), but the files.slack.com POST did not. Transient errors such as HTTP 504 therefore escaped even when the client had retry handlers configured. Fixes slackapi#1853
|
Thanks for the contribution! Before we can merge this, we need @DSeaStar to sign the Salesforce Inc. Contributor License Agreement. |
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.
Summary
files_upload_v2has three steps. Steps 1 and 3 (files.getUploadURLExternal/files.completeUploadExternal) go throughapi_call()and therefore honor the client's retry handlers. Step 2 — the raw POST to thefiles.slack.comupload URL — called_upload_file_via_v2_url()directly, so transient HTTP errors (the reporter sees 2–6 HTTP 504s per day) escaped to the caller.This change runs that POST through the same retry-handler loop used by
api_call(). Existing handlers (including custom ones that retry 504) now apply. When no handler matches, the originalHTTPErroris still raised.Fixes #1853
Testing
pytest tests/slack_sdk/web/test_web_client_file_upload_retry.pyHTTPErrorpytest tests/slack_sdk/web/test_web_client_http_retry.py tests/slack_sdk/web/test_web_client_http_retry_server_error.py tests/slack_sdk/http_retry/test_builtins.py(existing retry tests, still pass)Category
/docs(Documents)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements
Note: I did not run the full
./scripts/run_validation.shmatrix locally. Asyncfiles_upload_v2already used retry handlers; this PR only changes the sync path, as confirmed in #1853.