Ledger: how to tell an inbound (cloud-to-device) sync is pending before disconnecting?

Platform: Boron (BRN404X), Device OS 6.4.1

We use two cloud-to-device ledgers (product defaults plus per-device overrides) for configuration. Our battery-powered devices connect, publish, wait for their outbound ledger syncs to complete, then turn the modem off and sleep.

On cellular connections, an inbound ledger change often never arrives. The log shows:

[system.ledger] ERROR: Request failed: -1001
[system.ledger] ERROR: Synchronization failed: -1001; retrying in 30s

within milliseconds of our disconnect. Reading the 6.4.1 source, outbound syncs appear to be processed before inbound fetches, so the fetch starts just as we tear down. When we happened to stay connected about one more second, the update arrived.

What we checked:

  • The Ledger class has no pending or in-progress accessor. onSync() fires only on completion.
  • ledger_get_info() reports LEDGER_INFO_SYNC_PENDING, but it appears to cover only local changes not yet sent to the cloud, not an inbound fetch.
  • lastUpdated() on an inbound ledger changes only once the new data has arrived, so it can't warn us beforehand.

Questions:

  1. Is there a supported way for application firmware to know that an inbound ledger sync is pending or in progress, or that the post-connect check has finished and nothing is pending, so we wait only when needed?
  2. If not, would Particle consider adding one? For example, a Ledger::isSyncPending() that covers inbound fetches, or a callback or system event when the post-connect sync check completes.

For now, our workaround is to stay connected a few seconds longer once a day so configuration changes land within a day, but we'd rather not pay that cost blindly. Thanks!

Adding a notification API for cloud-to-device synchronization notification will be investigated in the next engineering sprint.

Thanks @rickkas7 — great to hear. In the meantime we hold the gate for up to 10 s once a day (boot and first connection after open), ending early on onSync; it works but a real signal would let us drop the timer. Happy to test a pre-release on our bench: BRN404X Borons on very poor Singtel coverage, where the disconnect-mid-fetch case happens daily.

We'll put a note here when it is landed in device-os should be in the next couple weeks, 6.6.0 just came out so I'm not sure when the next release will be of the OS but at least you'll be able to test with it once it lands.