1991santhu opened a new pull request, #11654:
URL: https://github.com/apache/seatunnel/pull/11654
### Purpose of this pull request
`calculateBackoffMillis` returns a pure function of the retry count:
```java
long exponential = 1L << Math.min(20, Math.max(0, retryCount - 1));
long waitMillis = rateLimitBackoffMs * exponential;
return Math.min(waitMillis, MAX_BACKOFF_MILLIS);
```
so every reader and writer waits for exactly the same durations.
That matters more here than for a generic retry, because this backoff fires
specifically on **HTTP 429**:
```java
if (response.getCode() == STATUS_TOO_MANY_REQUESTS && retryCount <
rateLimitMaxRetries) {
```
Airtable rate-limits per base, so 429 is a *shared* condition rather than a
per-client accident. Parallel readers or writers against the same base cross
the limit together, then retry at identical instants — so the burst that caused
the rate limiting reassembles on each attempt, and the retries arrive when the
API has just asked the client to slow down.
### Changes
Equal jitter: retain half the computed delay as a floor, randomise the
remainder.
```java
long half = waitMillis / 2;
return half + ThreadLocalRandom.current().nextLong(waitMillis - half + 1);
```
Half is kept rather than using full jitter so a retry is never issued
immediately after a 429. The result never exceeds the previous value or
`MAX_BACKOFF_MILLIS`, so no caller waits longer than it does today — the change
only removes the alignment.
The disabled case is untouched: `rateLimitBackoffMs <= 0` still returns `0L`.
Applied to both `AirtableSourceReader` and `AirtableSinkWriter`, which carry
identical copies of the method.
### Does this PR introduce _any_ user-facing change?
No configuration or API change. Retry delays now vary within `[wait/2,
wait]` instead of being exactly `wait`.
### How was this patch tested?
`mvn test -pl
seatunnel-connectors-v2/connector-http/connector-http-airtable` — **9 tests
pass**, including the existing `testRetryOn429ThenSuccess` and
`testStopRetryAfterMaxRetries`, which are unmodified.
Four new tests cover: backoff stays `0` when disabled; every result falls
within `[expected/2, expected]` across retries 1–5 sampled 200 times each;
successive calls vary, which fails if the implementation regresses to
deterministic; and the result never exceeds `MAX_BACKOFF_MILLIS`.
### Check list
* [x] Code changed are covered with tests
* [x] If any new Jar binary package adding in your PR, please add License
Notice according [New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
— no new dependencies added
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]