# Particle.publish sometimes blocks for tens of seconds on Electron

**URL:** <https://community.particle.io/t/particle-publish-sometimes-blocks-for-tens-of-seconds-on-electron/62353>\
**Category:** Firmware\
**Tags:** electron\
**Created:** [March 31, 2022, 6:36am UTC](https://community.particle.io/t/particle-publish-sometimes-blocks-for-tens-of-seconds-on-electron/62353 "2022-03-31T06:36:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![youngjin](https://avatars.discourse-cdn.com/v4/letter/y/e79b87/32.png) [@youngjin](https://community.particle.io/u/youngjin)\
**Post date:** [March 31, 2022, 6:36am UTC](https://community.particle.io/t/particle-publish-sometimes-blocks-for-tens-of-seconds-on-electron/62353/1 "2022-03-31T06:36:58Z")

</div>

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

my app is set up with SYSTEM\_THREAD(ENABLED) and SYSTEM\_MODE(SEMI\_AUTOMATIC).

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](https://community.particle.io/t/particle-publish-and-blocking/42022)

- 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?

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [March 31, 2022, 8:01am UTC](https://community.particle.io/t/particle-publish-sometimes-blocks-for-tens-of-seconds-on-electron/62353/2 "2022-03-31T08:01:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![youngjin](https://avatars.discourse-cdn.com/v4/letter/y/e79b87/32.png) [@youngjin](https://community.particle.io/u/youngjin)\
**Post date:** [March 31, 2022, 8:34am UTC](https://community.particle.io/t/particle-publish-sometimes-blocks-for-tens-of-seconds-on-electron/62353/3 "2022-03-31T08:34:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [April 30, 2022, 6:34pm UTC](https://community.particle.io/t/particle-publish-sometimes-blocks-for-tens-of-seconds-on-electron/62353/4 "2022-04-30T18:34:38Z")

</div>

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