Refactor incremental backoff and jitter with tests #1864
Labels
code-quality
Affects the developer experience when working in our codebase.
testing
Includes all kinds of automated tests, the way that we run them and the infrastructure around them.
Simplify unit tests for backoff and jitter since we already have a formula to generate lower and upper bounds.
Expression to calculate upper and lower bounds for generated values using getRetryTime
upper = min((retryCount + 2) / 3, 2) *initialTimeout
lower = 0.8 * upper
if x is a generated retryTimeout from getRetryTime, then
lower < x < upper
Backoff and jitter formula can be put in one file
ARTBackoffRetryDelayCalculator.m
same ashttps://github.com/ably/ably-java/blob/main/lib/src/main/java/io/ably/lib/util/ReconnectionStrategy.java
So, other files
BackoffCoefficients.swift
,StaticJitterCoefficients.swift
,ARTJitterCoefficientGenerator.m
andARTJitterCoefficientGenerator.h
should be removedUnit tests can be put in one file same as
https://github.com/ably/ably-java/blob/main/lib/src/test/java/io/ably/lib/util/ReconnectionStrategyTest.java
So, other files
DefaultJitterCoefficientGeneratorTests.swift
andMockJitterCoefficientGenerator.swift
can be removed┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: