From e7ba70606d85afe7fbe6f2c63be79e0fdacbe83e Mon Sep 17 00:00:00 2001 From: Eric Duong Date: Wed, 29 Nov 2023 21:41:51 -0500 Subject: [PATCH] chore(data-warehouse): don't raise if schedule already gone (#18978) don't raise if schedule already gone --- 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 7faaa89e418b1..2377864b295ee 100644 --- a/posthog/warehouse/data_load/service.py +++ b/posthog/warehouse/data_load/service.py @@ -25,6 +25,7 @@ ExternalDataJobWorkflow, ) from posthog.warehouse.models import ExternalDataSource +import temporalio def sync_external_data_job_workflow(external_data_source: ExternalDataSource, create: bool = False) -> str: @@ -66,4 +67,10 @@ def pause_external_data_workflow(external_data_source: ExternalDataSource): def delete_external_data_workflow(external_data_source: ExternalDataSource): temporal = sync_connect() - delete_schedule(temporal, schedule_id=str(external_data_source.id)) + try: + delete_schedule(temporal, schedule_id=str(external_data_source.id)) + except temporalio.service.RPCError as e: + # Swallow error if schedule does not exist already + if e.status == temporalio.service.RPCStatusCode.NOT_FOUND: + return + raise