Closed Bug 1164661 Opened 10 years ago Closed 10 years ago

taskcluster-client: Implement randomization factor for retries

Categories

(Taskcluster :: General, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jonasfj, Assigned: jonasfj)

Details

Attachments

(1 file)

We should have a randomization factor, as a percentage that can be randomly added/subtracted from the computed retry delay. Example: delay is computed to 5s randomization factor is 0.5 randomized delay is in [2.5; 7.5] I doubt it's critical, but probably nice to have, and really cheap.
Attached file Github PR
Let me know if this is crazy... Thanks, I'm aiming to do somewhat the same as you do in go.. Granted I stole this from: http://javadoc.google-http-java-client.googlecode.com/hg/1.17.0-rc/com/google/api/client/util/ExponentialBackOff.html And a few others that seemed to use the exact same logic.
Assignee: nobody → jopsen
Status: NEW → ASSIGNED
Attachment #8616916 - Flags: review?(pmoore)
Comment on attachment 8616916 [details] [review] Github PR Thanks Jonas. I double checked the maths, and all looks good! (Math.random() - 0.5) : gives a result in [-0.5, 0.5) => rf * 2 * (Math.random() - 0.5) : gives a result in [-rf, +rf) => 1 + rf * 2 * (Math.random() - 0.5) : gives a result in [1-rf, 1+rf) => delay * (1 + rf * 2 * (Math.random() - 0.5)) : gives a result in [delay - delay * rf, delay + delay * rf] = adjusted delay we want expanding: rf * 2 * (Math.random() - 0.5) = 2 * Math.random() * rf - rf gives: adjusted delay = delay * (1 + 2 * Math.random() * rf - rf) which is the same as the result you reached! :)
Attachment #8616916 - Flags: review?(pmoore) → review+
Merged and landed in tc-client v 0.22.2
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Component: TaskCluster → General
Product: Testing → Taskcluster
Target Milestone: --- → mozilla41
Version: unspecified → Trunk
Resetting Version and Target Milestone that accidentally got changed...
Target Milestone: mozilla41 → ---
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: