Skip to content

Commit

Permalink
ocean11
Browse files Browse the repository at this point in the history
  • Loading branch information
yairsimantov20 committed Oct 13, 2024
1 parent 34c0dfe commit 348205e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
5 changes: 3 additions & 2 deletions port_ocean/core/integrations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ async def start(self) -> None:
)

logger.info("Initializing event listener")
event_listener = await self.event_listener_factory.create_event_listener()
await event_listener.start()
# event_listener = await self.event_listener_factory.create_event_listener()
# await event_listener.start()

4 changes: 2 additions & 2 deletions port_ocean/log/logger_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
def setup_logger(level: LogLevelType, enable_http_handler: bool) -> None:
logger.remove()
_stdout_loguru_handler(level)
if enable_http_handler:
_http_loguru_handler(level)
# if enable_http_handler:
# _http_loguru_handler(level)


def _stdout_loguru_handler(level: LogLevelType) -> None:
Expand Down
21 changes: 10 additions & 11 deletions port_ocean/ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from pydantic import BaseModel
from starlette.types import Scope, Receive, Send

from port_ocean.core.handlers.resync_state_updater import ResyncStateUpdater
from port_ocean.core.models import Runtime
from port_ocean.clients.port.client import PortClient
from port_ocean.config.settings import (
IntegrationConfiguration,
Expand All @@ -20,13 +18,14 @@
ocean,
initialize_port_ocean_context,
)
from port_ocean.core.handlers.resync_state_updater import ResyncStateUpdater
from port_ocean.core.integrations.base import BaseIntegration
from port_ocean.core.models import Runtime
from port_ocean.log.sensetive import sensitive_log_filter
from port_ocean.middlewares import request_handler
from port_ocean.utils.repeat import repeat_every
from port_ocean.utils.signal import signal_handler
from port_ocean.version import __integration_version__
from port_ocean.utils.misc import IntegrationStateStatus


class Ocean:
Expand Down Expand Up @@ -77,20 +76,20 @@ async def _setup_scheduled_resync(
self,
) -> None:
async def execute_resync_all() -> None:
await self.resync_state_updater.update_before_resync()
# await self.resync_state_updater.update_before_resync()
logger.info("Starting a new scheduled resync")
try:
await self.integration.sync_raw_all()
await self.resync_state_updater.update_after_resync()
# 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
)
raise e
# except Exception as e:
# await self.resync_state_updater.update_after_resync(
# IntegrationStateStatus.Failed
# )
# raise e

interval = self.config.scheduled_resync_interval
loop = asyncio.get_event_loop()
Expand All @@ -102,7 +101,7 @@ async def execute_resync_all() -> None:
repeated_function = repeat_every(
seconds=interval * 60,
# Not running the resync immediately because the event listener should run resync on startup
wait_first=True,
wait_first=False,
)(
lambda: threading.Thread(
target=lambda: asyncio.run_coroutine_threadsafe(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "port-ocean"
version = "0.12.2-dev10"
version = "0.12.2-dev11"
description = "Port Ocean is a CLI tool for managing your Port projects."
readme = "README.md"
homepage = "https://app.getport.io"
Expand Down

0 comments on commit 348205e

Please sign in to comment.