Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Particle.publish Future appears to complete before send is finalized #1679
I have been attempting to trim down the time our device has to be connected to the network (Photon on Wifi), and the confirmation check for Particle.publish(,,,WITH_ACK) doesn't appear to be functioning properly. This may be related to the send happening immediately after connecting, or while system messages are being sent.
If I check the Future result and then immediately sleep, the message is never received by the cloud. If I merely insert a delay after checking the result, the message is received. I would expect that when success is set, the message has been actually sent (or not if it failed), and if the Future returns true the message appears in the cloud and it is safe to disconnect. This is not the case.
Additional debug output shows that the publish future returns true even though the message is not yet delivered, and in fact never appears in the cloud.
Example (firmware 1.0.0). If the delay line is uncommented, "bar" appears in the cloud. If the delay is not present, "bar" never appears.