Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particle.publish Future appears to complete before send is finalized #1679

Richard-Mansfield-4 opened this issue Jan 22, 2019 · 1 comment


Copy link

@Richard-Mansfield-4 Richard-Mansfield-4 commented Jan 22, 2019

Greetings :)

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.


void setup() {

int x = 0;

void loop() {

    particle::Future<bool> successfuture = Particle.publish("foo", "bar", PRIVATE, WITH_ACK);
    bool success = successfuture;
    if (success == true)

    Serial.write(x); //Make sure the compiler actually has to test success. This has no effect.
    __sync_synchronize(); //Make sure the above really did execute. This has no effect.

    //delay(1000000); //If uncommented, this causes the message to be received by the cloud. If this line is commented, the message does not appear.
    System.sleep(SLEEP_MODE_DEEP, 5);


This comment has been minimized.

Copy link

@WellBotLLC WellBotLLC commented Nov 30, 2019

Seeing a similar issue. However, I am getting false negatives. The publish is successful, but the ACK is returning false. Running 1.2.1 on Electron. SYSTEM_THREAD(ENABLED), SYSTEM_MODE(SEMI_AUTOMATIC).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.