The sync function is not stable?

Hi guys,
I have deployed an LTE beacon to scan other Bluetooth beacons to send processed distance data to the cloud for further use. I used the function like below:
image
The problem is the sync function is not stable, it starts well but sometimes pops up "storage " problem and suggests me to sync it. On the other hand, in the cloud log, I cannot always see the synced message I wanted.

sync.now() never throws any storage error. cloud.enqueue does. There are several storage errors that can be thrown. Which particular one are you getting? Please provide error message or code.
Note that sync.now() only triggers synchronization process which is running in the ‘background’. It may already have been started and you just enqueued a new event when sync process is finishing. No worries here, your events will be delivered during next sync.
It is possible that internal flash memory gets full and cloud.enqueue throws an exception before sync.now is called. If cloud.enqueue throws an error then you would not see it in cloud log anyway.
Try to avoid calling cloud.enqueue very frequently (like in ble.startScan callback) because it can fill up flash memory faster than modem can upload it to the Cloud and you will get many storage errors (more here). When beacon manages to send data those error message may be gone for a while.
cloud.setVar is better suited for dealing with values that change frequently. It only sends last value (if it was changed) and it does not use flash memory (more here).
Are your beacon running latest firmware (at this time it is 0.2.13)?

No, what’s the difference between firmware versions? I forgot to keep it updating? should I update now?

在 2020-12-03 06:52:12,“Łukasz Pobereżnik via Estimote Community Forums” estimote@discoursemail.com 写道:

Generally you should always update your devices and software to latest versions since they usually have improved stability, performance and fixed some bugs, most importantly in the security domain.
Almost every new release of LTE beacons firmware provide new API functions, improved performance, stability and security, better power consumption and a lot of bug fixes.
LTE Beacons should update automatically via LTE during synchronization, so you won’t forget to do it, unless you have switched off auto-updates for in the device settings or beacon is unable to communicate with cellular network.
Additionally you can try to update via BLE: when connected to device via WebIDE an Update to x.y.z should appear next to Firmware version on Beacon Settings tab.

I think you should fix your code in the first place, since it looks like it is using some anti-patterns mentioned in documentation (like calling sync.now() just after cloud.enqueue or probably invoking cloud.enqueue too frequently). You should keep your device’s firmware updated, but I don’t think it will fix your problem, it might only make it happen less frequently.

Thanks a lot! I tried to use setVar to replace enqueue, but how to invoke the event in cloud ? For cloud.enqueue,I can manipulate the event by the name of type, how could I write the similar syntax to choose different variable sent from the LTE beacon event?

在 2020-12-04 03:05:59,“Łukasz Pobereżnik via Estimote Community Forums” estimote@discoursemail.com 写道:

cloud.setVar should handle the same first two parameters as cloud.enqueue (name and message) so you basically need only change function name.
In Cloud Code you handle cloud.setVar in the same way you handle cloud.enqueue : they both generate the same kind of event (see docs).