Repository navigation
fix(collaboration): retry soon and keep the app URLs when the WOPI discovery fails - #4007
Open
pbleser-oc wants to merge 1 commit into
Open
pbleser-oc wants to merge 1 commit into
pbleser-oc wants to merge 1 commit into
Conversation
…scovery fails When a fetch of the WOPI discovery failed, the collaboration service cleared its app URLs, registered without mimetypes, and fetched again only after the full registration interval (30 s by default). Until then, opening documents failed, also when the WOPI app was only restarting. Meanwhile /readyz reported ready. - Retry a failed fetch after 1 s, doubling the delay up to the interval. - Keep the app URLs of the last successful fetch while retrying. Clear them only once the retries have backed off to the full interval, i.e. when the WOPI app has been unreachable for about one interval, so that it isn't offered while it is gone. - Limit a fetch to 10 s by default (COLLABORATION_APP_DISCOVERY_TIMEOUT), so a WOPI app that doesn't answer can't stop the refresh. - /readyz reports "not ready" until the app URLs have been fetched once; /healthz is unchanged. The loop moves from the server command into helpers.RefreshAppProvider, so it can be tested. Fixes opencloud-eu#3995 Assisted-by: Claude Code:claude-opus-5-5
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 27 |
🟢 Coverage 58.82% diff coverage · +0.06% coverage variation
Metric Results Coverage variation ✅ +0.06% coverage variation (-1.00%) Diff coverage ✅ 58.82% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (2ff7018) 94239 28124 29.84% Head commit (f9c6608) 94276 (+37) 28191 (+67) 29.90% (+0.06%) 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 (#4007) 68 40 58.82% 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.
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.
A single failed fetch of the WOPI discovery, e.g. while the office app restarts, no longer makes opening documents fail for up to 30 s, and
/readyzreports "not ready" until the collaboration service has the app URLs.Fixes #3995
Changes
COLLABORATION_CS3API_APP_REGISTRATION_INTERVAL, 30 s by default). Before, the next try came only after the full interval.COLLABORATION_APP_DISCOVERY_TIMEOUT(0 disables it). Without a timeout, an office app that accepts the connection but never answers would stop the refresh, and the re-registration, for good./readyzfails until the app URLs have been fetched once./healthzis unchanged. Once ready, the service stays ready, also when the URLs are cleared later.helpers.RefreshAppProvider, with unit tests against a fake discovery endpoint.Trade-off: keeping vs. clearing the app URLs
@butonic, you introduced the clearing in #1542 ("empty map to clear previous URLs"), so I'd like your opinion on this part. My understanding is that clearing keeps the registry honest: while the office app can't be reached, its mimetypes aren't advertised, and new page loads don't offer an app that would fail anyway.
The cost is that any single failed fetch removes the app for up to a full interval, although the office app may be back a second later. A web UI that is already loaded still offers the app, and opening a document then fails with a 500 ("Error contacting the requested application").
This PR keeps the clearing, but only for an outage of about one interval; shorter failures are bridged with the old URLs. During those ~30 s, opening a document fails for a really unreachable office app, as it does today. Would you prefer to keep clearing right away (with only the faster retry), or to never clear?
Deployments that probe the collaboration service
Deployments that check the collaboration service's own
/readyznow see it "not ready" until the office app has answered once. In a rolling update, a new instance then only becomes ready when the office app is reachable. The CI already waits for the collaboration services'/readyz(up to 300 s), so its wait now also covers the office app being ready.Notes
GetAppURLs(one HTTP client for all fetches). Whichever of the two is merged second needs a small rebase; the timeout then goes into the shared client.AI assistance: Claude Code (claude-opus-5-5) wrote the code and the tests, and the first draft of this description; I reviewed and adjusted them.