aminghadersohi commented on code in PR #42012:
URL: https://github.com/apache/superset/pull/42012#discussion_r3574768188


##########
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:
   The timeout clear narrows the test flake, but it does not cover an 
invocation already awaiting `fetchEvents()`. Once that old invocation resumes, 
it reaches `asyncEvent.ts:200` and schedules another timeout using the 
module-global `transport`; on polling→polling re-init this creates two loops, 
and on disabled re-init it can restart the supposedly stopped loop. Could we 
invalidate active callbacks with an initialization generation/active token 
(also guarding their error-count updates/event processing/reschedule) and add a 
deferred-fetch regression test for enabled and disabled re-init?



-- 
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]

Reply via email to