From b62e3be489878b2f5b194259b2b17ba6c5d93608 Mon Sep 17 00:00:00 2001 From: Eric Duong Date: Mon, 4 Dec 2023 12:33:40 -0500 Subject: [PATCH] chore(data-warehouse): add temporal schedule offset (#19056) add temporal schedule offset --- posthog/warehouse/data_load/service.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/posthog/warehouse/data_load/service.py b/posthog/warehouse/data_load/service.py index bd6eb0b744e11..93e120605be3a 100644 --- a/posthog/warehouse/data_load/service.py +++ b/posthog/warehouse/data_load/service.py @@ -44,7 +44,14 @@ def sync_external_data_job_workflow(external_data_source: ExternalDataSource, cr id=str(external_data_source.pk), task_queue=DATA_WAREHOUSE_TASK_QUEUE, ), - spec=ScheduleSpec(intervals=[ScheduleIntervalSpec(every=timedelta(hours=24))]), + spec=ScheduleSpec( + intervals=[ + ScheduleIntervalSpec( + every=timedelta(hours=24), offset=timedelta(hours=external_data_source.created_at.hour) + ) + ], + jitter=timedelta(hours=2), + ), state=ScheduleState(note=f"Schedule for external data source: {external_data_source.pk}"), policy=SchedulePolicy(overlap=ScheduleOverlapPolicy.CANCEL_OTHER), )