Particle.publish() took very long time up to ~12+ s to return

If possible, please post your actual code. That will help in the discussion.

There is a rate limit on the number of calls of Particle.publish() statements. So, typically, while initially developing your code, make a 1 second delay after each statement to help you stay within the rate limit just in case your code calls many publish statements in a row. Here is more about this:

https://community.particle.io/t/publish-rate-limit-missing-data/42981/2

A delay(x000); statement can be considered blocking.

Your loop() routine iterates endlessly and every time it "loops" it calls Particle.process() once, UNLESS your using SYSTEM_MODE(MANUAL). In the commented out statement of the example I offered, using the For() statement which calls Particle.process() can be considered a non-blocking delay.

Here is a thread which might help:

https://community.particle.io/t/particle-process-quirks/57463

1 Like