Problem
When the retry mechanism is active (using setInterval), calling send() again or navigating away does not clear the pending interval. This can cause:
- Memory leaks (interval keeps running)
- Double-sends (retry fires after a new
send() was already initiated)
- Unexpected behavior if the instance is reused
Current Implementation
this.retry.id = setInterval(function () {
i.retry.passed++;
i.retry.func(i.retry.wait - i.retry.passed, i.retry.pass_number);
if (i.retry.passed === i.retry.wait) {
clearInterval(i.retry.id);
i.retry.passed = 0;
i.retry.pass_number++;
i.AJAXRequest.send();
}
}, 1000);
Suggested Fix
- Before starting a new
send(), clear any existing retry interval
- On
abort(), clear the retry interval and reset retry state
- Store interval ID on the instance (not just XHR) so it is accessible for cleanup
Expected Behavior
- Only one retry cycle can be active at a time
- Aborting cancels pending retries
- Re-sending cancels pending retries from the previous request
Problem
When the retry mechanism is active (using
setInterval), callingsend()again or navigating away does not clear the pending interval. This can cause:send()was already initiated)Current Implementation
Suggested Fix
send(), clear any existing retry intervalabort(), clear the retry interval and reset retry stateExpected Behavior