Skip to content

Commit d10d1f7

Browse files
committed
fix: Convert to schedule timezone on activity retry
1 parent a29389c commit d10d1f7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

products/batch_exports/backend/temporal/backfill_batch_export.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ async def backfill_schedule(inputs: BackfillScheduleInputs) -> None:
172172
settings.TEMPORAL_CLIENT_KEY,
173173
)
174174

175-
details = temporalio.activity.info().heartbeat_details
175+
schedule_handle = client.get_schedule_handle(inputs.schedule_id)
176+
description = await schedule_handle.describe()
176177

178+
details = temporalio.activity.info().heartbeat_details
177179
if details:
178180
# If we receive details from a previous run, it means we were restarted for some reason.
179181
# Let's not double-backfill and instead wait for any outstanding runs.
@@ -195,9 +197,10 @@ async def backfill_schedule(inputs: BackfillScheduleInputs) -> None:
195197

196198
start_at = dt.datetime.fromisoformat(last_activity_details.last_batch_data_interval_end)
197199

198-
schedule_handle = client.get_schedule_handle(inputs.schedule_id)
200+
if description.schedule.spec.time_zone_name and description.schedule.spec.time_zone_name != "UTC":
201+
# Details is always in UTC, we must re-convert it to the schedule's timezone
202+
start_at = start_at.astimezone(dt.UTC)
199203

200-
description = await schedule_handle.describe()
201204
frequency = dt.timedelta(seconds=inputs.frequency_seconds)
202205

203206
if start_at is not None:

0 commit comments

Comments
 (0)