fix: set default timezone to UTC for cron timezone conversions (#29798)

This commit is contained in:
danielli-ziprecruiter 2024-08-01 10:49:47 -07:00 committed by GitHub
parent 1d2dee8a4e
commit e623d745f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import logging
from datetime import datetime
from datetime import datetime, timezone
from celery import Celery
from celery.exceptions import SoftTimeLimitExceeded
@ -50,7 +50,7 @@ def scheduler() -> None:
datetime.fromisoformat(scheduler.request.expires)
- app.config["CELERY_BEAT_SCHEDULER_EXPIRES"]
if scheduler.request.expires
else datetime.utcnow()
else datetime.now(tz=timezone.utc)
)
for active_schedule in active_schedules:
for schedule in cron_schedule_window(