-
Notifications
You must be signed in to change notification settings - Fork 30
Add retry logic when fetching addons, stop deleting a repo on fetching failures, and cache errors for smarter retry mechanism #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MarcBresson
wants to merge
11
commits into
FreeCAD:dev
Choose a base branch
from
MarcBresson:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
579e8d4
ENH: add retry mecanism to the addon cache builder
MarcBresson dc8815c
TST: add unit tests
MarcBresson dcaba5e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f178226
MAINT: reduce docstring's length since the code speaks for itself
MarcBresson e7df82c
TST: remove test for fresh reclone, and replace it with a test for le…
MarcBresson c7be70f
Merge remote-tracking branch 'origin/dev' into 'MarcBresson/AddonMana…
MarcBresson fa6d629
ENH: sync local copy of repo to the url given in the index
MarcBresson 486bb35
ENH: remove traceback from cache error
MarcBresson f0e964c
MAINT: manually resorting imports as they were before
MarcBresson 98d06aa
DEV: add vscode settings to gitignore
MarcBresson fb119b0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| # SPDX-FileNotice: Part of the AddonManager. | ||
|
|
||
| .idea | ||
| .vscode | ||
| __pycache* | ||
| .DS_Store | ||
|
|
||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the fallback reclone: it wasn't designed for the intermittent failure case you're trying to handle here, but for things like a repo rename, where there is no recovery short of a deletion. If you drop it, then I have to log into the server to manually do this anything someone renames a repo (for example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think deleting then recloning would have helped with a git pull problem, since the current path already fetches and hard resets the local repo. Renaming a repository has no effect on git itself, except when the remote URL changes, and even then git follows the redirect. A recent example was my own addon, which was renamed from FreeCad-Grid-Export to CarteGrid including the remote URL, and git followed the 301 and cloned successfully.
That said, looking closer there is a real gap that supports your point. The url passed into fetch_and_reset never actually gets applied to the local clone. So there's no git remote set-url origin anywhere in the update path. If a repo's URL changes in the catalog (rename, ownership transfer, host migration), the existing local clone just keeps fetching from whatever origin was set at the original clone. That works only as long as the old host keeps redirecting to the new one, and GitHub doesn't promise that survives a second rename or the old name getting reused by someone else. A move off GitHub wouldn't redirect at all.
So instead of bringing back delete and reclone, I'd rather fix that directly: add git remote set-url origin {url} before the fetch in fetch_and_reset, so the local remote always stays in sync with whatever the catalog currently says. That covers the case you are describing without reintroducing the part of the old code this PR is meant to remove, which is deleting a working copy before a replacement is confirmed.
I'll push that change very soon :)