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
Ledgerclass has no pending or in-progress accessor.onSync()fires only on completion. ledger_get_info()reportsLEDGER_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:
- 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?
- 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!