betodealmeida commented on code in PR #25239:
URL: https://github.com/apache/superset/pull/25239#discussion_r1327667676


##########
superset/tasks/cron_util.py:
##########
@@ -39,9 +39,9 @@ def cron_schedule_window(cron: str, timezone: str) -> 
Iterator[datetime]:
         logger.warning("Timezone %s was invalid. Falling back to 'UTC'", 
timezone)
     utc = pytz_timezone("UTC")
     # convert the current time to the user's local time for comparison
-    time_now = time_now.astimezone(tz)
-    start_at = time_now - timedelta(seconds=1)
-    stop_at = time_now + timedelta(seconds=window_size)
+    time_now = triggered_at.astimezone(tz)
+    start_at = time_now - timedelta(seconds=window_size / 2)
+    stop_at = time_now + timedelta(seconds=window_size / 2)

Review Comment:
   The window approach seems fundamentally brittle to me. Why can't we set 
`start_at` to the last time the task was scheduled to run instead, and keep 
iterating until we hit the current time?



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