Antonio-RiveroMartnez commented on code in PR #42012:
URL: https://github.com/apache/superset/pull/42012#discussion_r3574852890
##########
superset-frontend/src/middleware/asyncEvent.test.ts:
##########
@@ -173,6 +173,83 @@ describe('asyncEvent middleware', () => {
expect(fetchMock.callHistory.calls(CACHED_DATA_ENDPOINT)).toHaveLength(1);
});
+ test('backs off exponentially when polling requests keep failing', async
() => {
+ jest.useFakeTimers();
+ try {
+ fetchMock.clearHistory().removeRoutes();
+ fetchMock.get(EVENTS_ENDPOINT, { status: 403 });
+ asyncEvent.init(config);
Review Comment:
Good catch — agreed the timeout clear only covers the scheduled timer, not
an invocation already suspended at `fetchEvents()`. Implemented the
generation-token approach in 2a8be593ec: `init()` bumps `pollingGeneration`,
and `loadEventsFromApi` captures the generation on entry and bails at each
resumption point (after the fetch resolves or rejects, and before
rescheduling), so stale invocations can't touch the new generation's error
count, process events against the fresh listener map, or schedule a second loop.
Added both deferred-fetch regression tests (enabled re-init → exactly one
loop remains; disabled re-init → no polls at all). Verified they fail without
the guard and pass with it.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]