From 58e08386c8f05537380528f865ebb3979b050980 Mon Sep 17 00:00:00 2001 From: tankilevitch Date: Thu, 19 Sep 2024 19:24:57 +0300 Subject: [PATCH] fix overriding of next resync status --- CHANGELOG.md | 6 ++++++ port_ocean/core/integrations/mixins/sync_raw.py | 4 +++- port_ocean/ocean.py | 4 ++++ pyproject.toml | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02edc1e2cc..9afe4e146c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +## 0.10.12 (2024-09-19) + +### Bug Fixes + +- Fixed updating state of resync when the resync is being cancelled by a new resync event + ## 0.10.11 (2024-09-17) ### Improvements diff --git a/port_ocean/core/integrations/mixins/sync_raw.py b/port_ocean/core/integrations/mixins/sync_raw.py index 0b306ff6ab..87fd2a8faf 100644 --- a/port_ocean/core/integrations/mixins/sync_raw.py +++ b/port_ocean/core/integrations/mixins/sync_raw.py @@ -456,7 +456,8 @@ async def sync_raw_all( creation_results.append(await task) except asyncio.CancelledError as e: - logger.warning("Resync aborted successfully") + logger.warning("Resync aborted successfully, skipping delete phase. This leads to an incomplete state") + raise else: if not did_fetched_current_state: logger.warning( @@ -489,3 +490,4 @@ async def sync_raw_all( {"before": entities_at_port, "after": flat_created_entities}, user_agent_type, ) + logger.info("Resync finished successfully") diff --git a/port_ocean/ocean.py b/port_ocean/ocean.py index 16b8b7ccda..caf983546f 100644 --- a/port_ocean/ocean.py +++ b/port_ocean/ocean.py @@ -82,6 +82,10 @@ async def execute_resync_all() -> None: try: await self.integration.sync_raw_all() await self.resync_state_updater.update_after_resync() + except asyncio.CancelledError: + logger.warning( + "resync was cancelled by the scheduled resync, skipping state update" + ) except Exception as e: await self.resync_state_updater.update_after_resync( IntegrationStateStatus.Failed diff --git a/pyproject.toml b/pyproject.toml index 7f43fe1200..89bbad686f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.10.11" +version = "0.10.12" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"