timkpaine commented on PR #30083:
URL: https://github.com/apache/airflow/pull/30083#issuecomment-1649829108
after a few months away, I think all this code is unnecessary. You can
simply force `_should_fix_dst` to `False`. The code that I'm "fixing" here was
deliberately introduced in order to make sure something that runs at e.g. 9am
runs at 10am during DST. To revert it, you don't need to add additional
adjustment code, you just need to undo it:
```
@cached_property
def _should_fix_dst(self) -> bool:
# Deprecated
return False
def _get_next(self, current: DateTime) -> DateTime:
"""Get the first schedule after specified time."""
naive = make_naive(current, self._timezone)
cron = croniter(self._expression, start_time=naive)
scheduled = cron.get_next(datetime.datetime)
return convert_to_utc(make_aware(scheduled, self._timezone))
def _get_prev(self, current: DateTime) -> DateTime:
"""Get the first schedule before specified time"""
naive = make_naive(current, self._timezone)
cron = croniter(self._expression, start_time=naive)
scheduled = cron.get_prev(datetime.datetime)
return convert_to_utc(make_aware(scheduled, self._timezone))
```
I'm happy to make this change if desired.
--
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]