Hello there,
I'm building a power-sensitive application using a Boron with SYSTEM_MODE(SEMI_AUTOMATIC) and ULTRA_LOW_POWER sleep, using the Device OS 6.3.0 extended publish CloudEvent API. I'm managing publish state with a non-blocking FSM that polls isSent() and isError() each loop() tick after making a publish request.
The documentation states that the CloudEvent must remain allocated until the publish completes by success or failure, but does not address whether completion is guaranteed. My core question is:
Is it guaranteed that a CloudEvent publish will always resolve to either isSent()==true or isError()==true, within a specified timeout time?
Specifically I'd like to understand:
-
Is there an internal Device OS timeout after which a publish that has neither succeeded nor failed will be resolved to
isError()==true? If there is a timeout, does it depend at all on payload size? -
If the connection drops after
Particle.publish()is called, does Device OS retry the publish after reconnecting and eventually resolve the CloudEvent one way or another (including maybe applying the timeout if any)? -
Clearly we should check
Particle.connected()before making the publish call, but I’m intrigued by what happens if the connection was never established, or drops before the publish call: Does the CloudEvent resolve immediately toisError()==true, or does it remain unresolved until the next connection, or (probably unlikely) does the Device OS automatically try to connect? -
We are using
Particle.setDisconnectOptions(CloudDisconnectOptions().graceful(true).timeout(timeoutMs))to allow in-flight publishes to complete before disconnecting. Does this graceful timeout interact with CloudEvent resolution — specifically, does it guarantee that any pending CloudEvent will resolve toisSent()orisError()within the specified timeout window? Or does it only apply to the legacy publish API? What would be an appropriate timeoutMS to use?
The reason all this matters is that I need to know whether to implement my own timeout in the FSM before allowing the device to sleep. If Device OS guarantees that isSent() or isError() will always eventually become true within a bounded time — whether through its own internal timeout or via the graceful disconnect timeout — I can rely on that. If not, I need a user-implemented timeout to prevent the FSM blocking indefinitely before sleep, which in a power-sensitive application could mean never sleeping at all.
Thank you!