straight.el icon indicating copy to clipboard operation
straight.el copied to clipboard

Makes `straight-vc-fetch-from-remote` retry serval times when fetch failed.

Open colawithsauce opened this issue 3 years ago • 5 comments

The network situation in China is not very stable, in that we must use proxy to access GitHub. However, this leads another question: git clone or git pull may throws SSL_SYSCALL_ERROR randomly when network connect situation fluctuating.

In that we have to use the following command as a workaround:

until doom upgrade; do; echo "Error, Again"; done;

to assure this process success.

I use doom emacs, in which straight.el is the core module to install and update packages. I had open an feature request in doom's issue page(https://github.com/doomemacs/doomemacs/issues/6458), but didn't get any reply. I found that at this line

https://github.com/doomemacs/doomemacs/blob/master/core/cli/packages.el#L140

the doom-cli makes the selected package upgraded(By call git fetch origin), and would print the error messages and immediately quit the process when command (straight-vc-fetch-from-remote recipe) failed.

Could straight makes this function(straight-vc-fetch-from-remote) retry 3 or 5 times when the git fetch process failed? This would improve the users with bad network situation 's experience magnificently.

colawithsauce avatar Jun 26 '22 04:06 colawithsauce

If the retry times can be customed, that will be better.

Joxos avatar Jul 27 '22 08:07 Joxos

Thanks for the suggestion. I'd have to think more on how to handle this design wise. Ideally we could have an option which would allow any network activity to be retried several times before giving up. How to do that in the least invasive way would need to be figured out.

Can't promise I will be able to get to this feature any time soon, but I am willing to help out if with advice if anyone wishes to give a pull request a shot.

progfolio avatar Aug 11 '22 20:08 progfolio

I think if the fetch errors, then when running interactively you'd get an error popup and would have to option to retry. Perhaps what is needed is to expose those error popups for programmatic usage so that a frontend like Doom would be able to proxy those questions to the user?

Or allow providing a callback that would automatically answer error dialogs based on the questions they are asking. We already do this, sort of, in that we have straight-vc-git-auto-fast-forward. Really, that should be an extensible system.

raxod502 avatar Aug 15 '22 00:08 raxod502

This is still an issue today that would be great to solve. When trying to update packages, if one GitHub connection fails, then whole process stops and needs to be started again. When upgrading close to 250 packages, it's then almost impossible (with a not-so-great Internet connection) to be able to update all packages successfully.

UndeadKernel avatar Aug 03 '23 09:08 UndeadKernel

When using straight-fetch-all this isn't an issue, as you get the error interactively and can retry on a per-package basis. This is a problem with how Doom is integrating.

raxod502 avatar Aug 12 '23 00:08 raxod502