diff --git a/posthog/temporal/workflows/s3_batch_export.py b/posthog/temporal/workflows/s3_batch_export.py index 14568c44541f2..6db75b007c69e 100644 --- a/posthog/temporal/workflows/s3_batch_export.py +++ b/posthog/temporal/workflows/s3_batch_export.py @@ -230,11 +230,6 @@ async def __aenter__(self): return self async def __aexit__(self, exc_type, exc_value, traceback) -> bool: - if exc_value is None: - # Succesfully completed the upload - await self.complete() - return True - if exc_type == asyncio.CancelledError: # Ensure we clean-up the cancelled upload. await self.abort() @@ -445,6 +440,8 @@ async def worker_shutdown_handler(): last_uploaded_part_timestamp = result["inserted_at"] activity.heartbeat(last_uploaded_part_timestamp, s3_upload.to_state()) + await s3_upload.complete() + @workflow.defn(name="s3-export") class S3BatchExportWorkflow(PostHogWorkflow):