mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-06 18:01:22 +02:00
Calm it down on sync logs
This commit is contained in:
+3
-4
@@ -307,7 +307,7 @@ async def sync_and_offload_channels(mc: MeshCore, max_channels: int | None = Non
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Error clearing channel %d: %s", idx, e)
|
logger.warning("Error clearing channel %d: %s", idx, e)
|
||||||
|
|
||||||
logger.info("Synced %d channels, cleared %d from radio", synced, cleared)
|
logger.debug("Synced %d channels, cleared %d from radio", synced, cleared)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Error during channel sync: %s", e)
|
logger.error("Error during channel sync: %s", e)
|
||||||
@@ -428,7 +428,6 @@ async def ensure_default_channels() -> None:
|
|||||||
|
|
||||||
async def sync_and_offload_all(mc: MeshCore) -> dict:
|
async def sync_and_offload_all(mc: MeshCore) -> dict:
|
||||||
"""Run fast startup sync, then background contact reconcile."""
|
"""Run fast startup sync, then background contact reconcile."""
|
||||||
logger.info("Starting full radio sync and offload")
|
|
||||||
|
|
||||||
# Contact on_radio is legacy/stale metadata. Clear it during the offload/reload
|
# Contact on_radio is legacy/stale metadata. Clear it during the offload/reload
|
||||||
# cycle so old rows stop claiming radio residency we do not actively track.
|
# cycle so old rows stop claiming radio residency we do not actively track.
|
||||||
@@ -1057,7 +1056,7 @@ async def sync_contacts_from_radio(mc: MeshCore) -> dict:
|
|||||||
return {"synced": 0, "radio_contacts": {}, "error": str(result)}
|
return {"synced": 0, "radio_contacts": {}, "error": str(result)}
|
||||||
|
|
||||||
contacts = _normalize_radio_contacts_payload(result.payload)
|
contacts = _normalize_radio_contacts_payload(result.payload)
|
||||||
logger.info("Found %d contacts on radio", len(contacts))
|
logger.debug("Found %d contacts on radio", len(contacts))
|
||||||
|
|
||||||
for public_key, contact_data in contacts.items():
|
for public_key, contact_data in contacts.items():
|
||||||
await ContactRepository.upsert(
|
await ContactRepository.upsert(
|
||||||
@@ -1071,7 +1070,7 @@ async def sync_contacts_from_radio(mc: MeshCore) -> dict:
|
|||||||
)
|
)
|
||||||
synced += 1
|
synced += 1
|
||||||
|
|
||||||
logger.info("Synced %d contacts from radio snapshot", synced)
|
logger.debug("Synced %d contacts from radio snapshot", synced)
|
||||||
return {"synced": synced, "radio_contacts": contacts}
|
return {"synced": synced, "radio_contacts": contacts}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Error during contact snapshot sync: %s", e)
|
logger.error("Error during contact snapshot sync: %s", e)
|
||||||
|
|||||||
@@ -215,7 +215,14 @@ async def run_post_connect_setup(radio_manager) -> None:
|
|||||||
# Sync contacts/channels from radio to DB and clear radio
|
# Sync contacts/channels from radio to DB and clear radio
|
||||||
logger.info("Syncing and offloading radio data...")
|
logger.info("Syncing and offloading radio data...")
|
||||||
result = await sync_and_offload_all(mc)
|
result = await sync_and_offload_all(mc)
|
||||||
logger.info("Sync complete: %s", result)
|
c = result.get("contacts", {})
|
||||||
|
ch = result.get("channels", {})
|
||||||
|
logger.info(
|
||||||
|
"Sync complete: %d contacts synced, %d channels synced, %d channels cleared",
|
||||||
|
c.get("synced", 0),
|
||||||
|
ch.get("synced", 0),
|
||||||
|
ch.get("cleared", 0),
|
||||||
|
)
|
||||||
|
|
||||||
# Send advertisement to announce our presence (if enabled and not throttled)
|
# Send advertisement to announce our presence (if enabled and not throttled)
|
||||||
if await send_advertisement(mc):
|
if await send_advertisement(mc):
|
||||||
|
|||||||
Reference in New Issue
Block a user