huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
45 stars 22 forks source link

Unnecessary wait after last failed retry #163

Closed CraigMacomber closed 3 years ago

CraigMacomber commented 3 years ago

When retrying 5 times, there is a wait between each retry (good), however there is also a wait after the last retry which is just wasted time. Since each retry doubles the wait, this wasted retry is actually longer than all the others combined.

You can see an example of this in the output of other issues file here, for example in: https://github.com/huserben/TfsExtensions/issues/161

The particular case I ran into is included below:

2021-02-12T20:26:43.0046671Z Error during request (1/5)
2021-02-12T20:26:43.0049372Z Error message: Error: Could not *** the build because there were validation errors or warnings.
2021-02-12T20:26:43.0050092Z Will wait 1 seconds before retrying request...
2021-02-12T20:26:44.0790300Z Error during request (2/5)
2021-02-12T20:26:44.0794353Z Error message: Error: Could not *** the build because there were validation errors or warnings.
2021-02-12T20:26:44.0796856Z Will wait 2 seconds before retrying request...
2021-02-12T20:26:46.1354138Z Error during request (3/5)
2021-02-12T20:26:46.1357197Z Error message: Error: Could not *** the build because there were validation errors or warnings.
2021-02-12T20:26:46.1360134Z Will wait 4 seconds before retrying request...
2021-02-12T20:26:50.2077928Z Error during request (4/5)
2021-02-12T20:26:50.2080127Z Error message: Error: Could not *** the build because there were validation errors or warnings.
2021-02-12T20:26:50.2083542Z Will wait 8 seconds before retrying request...
2021-02-12T20:26:58.2828434Z Error during request (5/5)
2021-02-12T20:26:58.2835310Z Error message: Error: Could not *** the build because there were validation errors or warnings.
2021-02-12T20:26:58.2849960Z Will wait 16 seconds before retrying request...
2021-02-12T20:27:14.2929004Z ##[error]Request failed after 5 tries - see error messages in the log

There is also the issue regarding these error messages not being very descriptive (The actual issue was the branch we were trying to checkout did not exist): I don't know if that's caused by this extension or not though.

huserben commented 3 years ago

Hi @CraigMacomber

Thanks for bringing this up. Seems like a low hanging fruit to reduce wasted time - i'll check it out and let you know once there's a fix available.

huserben commented 3 years ago

Hi @CraigMacomber

I just updated the tasks and now we shouldn't have that problem anymore.

If you'd like to verify please go ahead and please let me know whether it works as expected. If not (as I guess it's hard to reproduce anyway...) you can also directly close the issue.

Thanks for reporting this and helping improve the tasks, it's appreciated. Please don't hesitate to add more issues in case you find a problem or have a question.

CraigMacomber commented 3 years ago

I don't actually know how to easily reproduce this in our setup (I just saw it in output when things broke once). Feel free to close the issue if you want, and if I ever see it again (and we are on a version that should be fixed) I'll reopen it.