zephyring commented on code in PR #25239:
URL: https://github.com/apache/superset/pull/25239#discussion_r1324863337
##########
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:
If using triggered_time which could be 2 mins ago, this stop_at(30 seconds)
will be preventing the schedule from being executed right? see line 47.
I think we just need to base start_at 1 seconds before the triggered_at.
Reasons being cron expression can support second level granularity. If cron job
is every second and start at is 30 seconds ago, we will actually execute 30
tasks before the actual start at.
And base stop_at window_size after current_time, although I am not sure why
we need that stop_at at all.
--
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]