diff --git a/port_ocean/utils/repeat.py b/port_ocean/utils/repeat.py index 1bda9e24d8..d762650299 100644 --- a/port_ocean/utils/repeat.py +++ b/port_ocean/utils/repeat.py @@ -61,26 +61,27 @@ async def wrapped() -> None: async def loop() -> None: nonlocal repetitions - if wait_first: - await asyncio.sleep(seconds) - while max_repetitions is None or repetitions < max_repetitions: - # count the repetition even if an exception is raised - repetitions += 1 - try: - if is_coroutine: - task = asyncio.create_task(func()) - signal_handler.register(lambda: task.cancel()) - ensure_future(task) - else: - await run_in_threadpool(func) - except Exception as exc: - formatted_exception = "".join( - format_exception(type(exc), exc, exc.__traceback__) - ) - logger.error(formatted_exception) - if raise_exceptions: - raise exc + # if wait_first: + # await asyncio.sleep(seconds) + # count the repetition even if an exception is raised + repetitions += 1 + try: + if is_coroutine: + task = asyncio.create_task(func()) + signal_handler.register(lambda: task.cancel()) + ensure_future(task) + else: + run_in_threadpool(func) + except Exception as exc: + formatted_exception = "".join( + format_exception(type(exc), exc, exc.__traceback__) + ) + logger.error(formatted_exception) + if raise_exceptions: + raise exc await asyncio.sleep(seconds) + if max_repetitions is None or repetitions < max_repetitions: + asyncio.get_event_loop().call_later(seconds, loop) ensure_future(loop()) diff --git a/pyproject.toml b/pyproject.toml index 5641228ec6..6cb4724a65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.12.2-dev12" +version = "0.12.2-dev13" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"