Skip to content

fix(collaboration): retry GetFile downloads while the file is in postprocessing - #4108

Open
pbleser-oc wants to merge 1 commit into
opencloud-eu:mainfrom
pbleser-oc:fix/4106-getfile-too-early
Open

pbleser-oc wants to merge 1 commit into
opencloud-eu:mainfrom
pbleser-oc:fix/4106-getfile-too-early

Conversation

@pbleser-oc

Copy link
Copy Markdown
Member

Description

GetFile in the collaboration service now retries the download when the data gateway answers 425 Too Early: up to 6 times, waiting from 20ms up to 640ms between the attempts (1.26s in total), and it stops early when the request is canceled. If the file is still in postprocessing after that, it answers 500 as before.

Limitation: this covers fast postprocessing only, as in the CI. Servers with longer postprocessing steps, such as a virus scan, can still run out of retries. How to handle those needs a team decision: #4107.

Related Issue

Motivation and Context

With asynchronous uploads, a new file version is in postprocessing for a short while after a PutFile, and the download answers 425 until it is done. GetFile turned every download status other than 200 into a 500. That made the WOPI validator test EditFlows/BasicEdit fail now and then in the CI, and office apps that reload a document right after a save get the same 500.

How Has This Been Tested?

  • test environment: unit tests, go test -race ./services/collaboration/pkg/connector/..., 5 runs
  • test case 1: the download answers 425 twice, then succeeds
  • test case 2: the download never stops answering 425: 7 attempts, then 500
  • test case 3: the request is canceled while waiting
  • all three fail without the fix

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

AI assistance: Claude Code (claude-opus-5-5) wrote the first draft of the code, the tests and this description; I reviewed them.

…processing

With asynchronous uploads, a new file version is in postprocessing for a
short while after a PutFile, and the download from the data gateway
answers "425 Too Early" until it is done. GetFile turned that into a 500,
which made the WOPI validator test EditFlows/BasicEdit fail now and then,
and which office apps get when they reload a document right after a save.

Retry the download on a 425 up to 6 times, waiting from 20ms up to 640ms
between the attempts (1.26s in total), and stop early when the request is
canceled. If the file is still in postprocessing after that, GetFile
answers 500 as before.

Fixes opencloud-eu#4106

Assisted-by: Claude Code:claude-opus-5-5
@codacy-production

codacy-production Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 11 complexity

Metric Results
Complexity 11

View in Codacy

🟢 Coverage 90.63% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation ✅ +0.00% coverage variation (-1.00%)
Diff coverage ✅ 90.63% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (dc749a3) 94500 28684 30.35%
Head commit (178153a) 94523 (+23) 28695 (+11) 30.36% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4108) 32 29 90.63%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

collaboration: GetFile fails with 500 right after a PutFile while the file is in postprocessing

1 participant