"""Background worker: sync reconcile + report jobs."""

from __future__ import annotations

import logging
import time

logger = logging.getLogger(__name__)


def run_sync_reconcile() -> int:
    from app.modules.sync.reconcile import run_sync_reconcile as _reconcile

    return _reconcile()


def main() -> None:
    logging.basicConfig(level=logging.INFO)
    logger.info("worker started")
    while True:
        try:
            run_sync_reconcile()
        except Exception:
            logger.exception("reconcile failed")
        time.sleep(300)


if __name__ == "__main__":
    main()
