This commit is contained in:
Your Name
2026-04-16 21:35:47 +08:00
parent ff32aa50bf
commit ebf632e651
86 changed files with 14097 additions and 585 deletions

View File

@@ -0,0 +1,37 @@
from __future__ import annotations
import logging
import time
from app.core.config import settings
from app.services.sync_push_service import push_runtime_projection_now
logger = logging.getLogger("domaincheck.sync_agent")
def main() -> None:
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
)
interval = max(10, int(settings.sync_poll_interval_seconds or 30))
logger.info(
"sync agent started: node=%s source=%s target=%s interval=%ss enabled=%s",
settings.node_code,
settings.sync_source_region,
settings.sync_target_region,
interval,
settings.sync_push_enabled,
)
while True:
try:
ok, message, data = push_runtime_projection_now()
logger.info("sync tick: ok=%s message=%s data=%s", ok, message, data)
except Exception as exc:
logger.exception("sync tick failed: %s", exc)
time.sleep(interval)
if __name__ == "__main__":
main()