codeant-ai-for-open-source[bot] commented on code in PR #42481:
URL: https://github.com/apache/superset/pull/42481#discussion_r3681897864


##########
superset/commands/report/execute.py:
##########
@@ -1195,10 +1377,26 @@ class ReportNotTriggeredErrorState(BaseReportState):
     - Error
     """
 
-    current_states = [ReportState.NOOP, ReportState.ERROR]
+    current_states = [ReportState.NOOP, ReportState.ERROR, 
ReportState.RETRYING]
     initial = True
 
     def next(self) -> None:  # noqa: C901
+        # If retries from a previous crontab window are still in-flight and
+        # this is a new crontab trigger, skip — let the active retry chain
+        # finish.  The stale-window check uses normalized (naive) datetimes
+        # so tz-aware vs naive mismatches don't cause false positives.
+        if (
+            self._report_schedule.last_state == ReportState.RETRYING
+            and self._is_retry_window_stale()
+        ):
+            logger.info(
+                "Skipping crontab execution for report %s — retries from a "
+                "previous window are still in-flight (execution %s)",
+                self._report_schedule.id,
+                self._execution_id,
+            )
+            return

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag skipping a crontab window while retries from a previous window 
are active; avoiding concurrent execution is intentional to prevent duplicate 
emails and race conditions.
   
   **Applied to:**
     - `superset/commands/report/execute.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



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