fetch-event-source
fetch-event-source copied to clipboard
fix: create a new controller before dispose, cause loop request when …
trafficstars
hi, this is my case.
sometimes, call create before dispose when caught exception, but curRequestController get a new AbortController, so it doesn't work.
async function create() {
curRequestController = new AbortController();
try {
....
} catch (err) {
retryTimer = window.setTimeout(create, interval);
dispose();
}
so , i fixed it by use origin curRequestController first:
curRequestController = curRequestController || new AbortController();