request_with_retry: retry a bit harder, for a bit longer #4569

Open
adamwill wants to merge 1 commit from adamwill/koji:retry-harder into master
Contributor

I'm no mathematrician, but IIUC, retry_factor 0.3 and retries 3
will sleep 0.15, 0.3, 0.6 seconds between tries, then give up.
That's...really not very long to wait to survive some kind of
transient borkage on the server.

With retry factor 1 and retries 5, I believe we'll sleep 0.5, 1,
2, 4, 8 seconds between tries, which feels like it gives us a bit
better chance of winning. See:
https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry

Signed-off-by: Adam Williamson awilliam@redhat.com

I'm no mathematrician, but IIUC, retry_factor 0.3 and retries 3 will sleep 0.15, 0.3, 0.6 seconds between tries, then give up. That's...really not very long to wait to survive some kind of transient borkage on the server. With retry factor 1 and retries 5, I believe we'll sleep 0.5, 1, 2, 4, 8 seconds between tries, which feels like it gives us a bit better chance of winning. See: https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry Signed-off-by: Adam Williamson <awilliam@redhat.com>
I'm no mathematrician, but IIUC, retry_factor 0.3 and retries 3
will sleep 0.15, 0.3, 0.6 seconds between tries, then give up.
That's...really not very long to wait to survive some kind of
transient borkage on the server.

With retry factor 1 and retries 5, I believe we'll sleep 0.5, 1,
2, 4, 8 seconds between tries, which feels like it gives us a bit
better chance of winning. See:
https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Author
Contributor

@tkopecek , since you introduced this.

I came to this via https://github.com/fedora-infra/bodhi/pull/6103 . We noticed several Fedora CI failures that were due to bodhi updates download failing to get all the packages. I wrote that PR but then thought, meh, it's just a wrapper around koji download-build, why not just put the retries in Koji? So I came to Koji and found out that retries are already here, but...maybe this would make them more likely to work?

@tkopecek , since you introduced this. I came to this via https://github.com/fedora-infra/bodhi/pull/6103 . We noticed several Fedora CI failures that were due to `bodhi updates download` failing to get all the packages. I wrote that PR but then thought, meh, it's just a wrapper around `koji download-build`, why not just put the retries in Koji? So I came to Koji and found out that retries are already here, but...maybe this would make them more likely to work?
Owner

It was originally meant to solve only network hiccups, so second try should +- succeed. I've not seen any errors since, but I think it is ok to raise the defaults - here we would be at 0 + 2 + 4 + 6 + 8 = 30 seconds at max. @mikem ?

It was originally meant to solve only network hiccups, so second try should +- succeed. I've not seen any errors since, but I think it is ok to raise the defaults - here we would be at 0 + 2 + 4 + 6 + 8 = 30 seconds at max. @mikem ?
tkopecek added this to the 1.37 milestone 2026-10-09 09:18:16 +00:00
tkopecek modified the milestone from 1.37 to 1.36.2 2026-10-09 09:18:21 +00:00
tkopecek requested review from mikem 2026-10-09 09:18:27 +00:00
tkopecek modified the milestone from 1.36.2 to 1.37 2026-10-09 14:20:46 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u retry-harder:adamwill-retry-harder
git switch adamwill-retry-harder

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff adamwill-retry-harder
git switch adamwill-retry-harder
git rebase master
git switch master
git merge --ff-only adamwill-retry-harder
git switch adamwill-retry-harder
git rebase master
git switch master
git merge --no-ff adamwill-retry-harder
git switch master
git merge --squash adamwill-retry-harder
git switch master
git merge --ff-only adamwill-retry-harder
git switch master
git merge adamwill-retry-harder
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
koji/koji!4569
No description provided.