bito-code-review[bot] commented on code in PR #43486:
URL: https://github.com/apache/superset/pull/43486#discussion_r3847674183
##########
superset-frontend/src/middleware/asyncEvent.ts:
##########
@@ -155,30 +164,66 @@ const applyStatus = (taskId: string, status: string) => {
};
const loadStatusChanges = async (generation: number) => {
- if (generation !== pollingGeneration) return;
+ if (generation !== pollingGeneration) {
+ pollingActive = false;
+ return;
+ }
if (waitersByTaskId.size) {
try {
const { statuses, cursor: next } = await fetchStatusChanges({
cursor,
task_type: CHART_QUERY_TASK_TYPE,
});
- if (generation !== pollingGeneration) return;
+ if (generation !== pollingGeneration) {
+ pollingActive = false;
+ return;
+ }
cursor = next;
- Object.entries(statuses).forEach(([taskId, { status }]) =>
- applyStatus(taskId, status),
- );
+ // "Progress" = the batch carried a change for a task we're awaiting;
check
+ // membership before applyStatus, which deletes a settled task's waiters.
+ let progressed = false;
+ Object.entries(statuses).forEach(([taskId, { status }]) => {
+ if (waitersByTaskId.has(taskId)) progressed = true;
+ applyStatus(taskId, status);
+ });
+ // Reset to eager on an awaited-task change; otherwise back off
(bounded).
+ currentPollDelayMs = progressed
+ ? pollingDelayMs
+ : Math.min(currentPollDelayMs * 2, pollBackoffMaxMs);
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing backoff integration tests</b></div>
<div id="fix">
The backoff behavior (lines 184–192) is described in comments and
implemented in code, but asyncEvent.test.ts has no tests for the exponential
delay progression or ensurePolling() wake/idempotent semantics. A future
refactor could silently revert this logic without test coverage catching it.
</div>
</div>
<small><i>Code Review Run #fd113b</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]