Particle.publish sometimes blocks for tens of seconds on Electron

I am running an app built on Device OS 1.5.2 on a Electron


I’ve noticed that sometimes when Particle.publish is called, it causes long blocks of around 80 seconds.

Subsequently, a cloud reconnection for about 200 to 1000 seconds is executed. (status LED is rapidly blinking cyan)

I checked and applied the contents of the following link.

Particle publish and blocking

  • checking Particle.connected() before calling Particle.publish()
  • don’t test the result of Particle.publish()

However, long blocks are still occurring.

Is this normal behavior?

Pretty much yes, it is expected. If you really must minimize blocking:

  • Also make sure you never make any call that acquires a cellular mutex from the loop thread. The most common problem is Cellular,RSSI(), but any cellular call can exhibit this behavior.
  • Only perform publish operations from a background worker thread, not ever from the main loop thread.
  • Gen 3 (B Series SoM, Boron, Tracker) devices have slightly different blocking behavior than the Electron/E Series.
1 Like

@rickkas7 Thanks very much for the detailed explanation. I really do appreciate it!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.