Skip to content

Commit

Permalink
fix(backfill-batch-exports): Account for jitter (#18121)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias authored Oct 20, 2023
1 parent 1ab80f4 commit b799bc4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions posthog/temporal/workflows/backfill_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,18 @@ async def backfill_schedule(inputs: BackfillScheduleInputs) -> None:

handle = client.get_schedule_handle(inputs.schedule_id)

description = await handle.describe()
jitter = description.schedule.spec.jitter

frequency = dt.timedelta(seconds=inputs.frequency_seconds)
full_backfill_range = backfill_range(start_at, end_at, frequency * inputs.buffer_limit)

for backfill_start_at, backfill_end_at in full_backfill_range:
utcnow = dt.datetime.utcnow()

if jitter is not None:
backfill_end_at = backfill_end_at + jitter

backfill = temporalio.client.ScheduleBackfill(
start_at=backfill_start_at,
end_at=backfill_end_at,
Expand Down

0 comments on commit b799bc4

Please sign in to comment.