Anyone know what a max duration between the following steps would be:
- Particle.Publish()
- Webhook to my backend
- Backend making an API call to “https://api.particle.io/v1/devices/:deviceId/:functionName”
- Particle.Function() being called on the device
Reason I ask is my device wakes up periodically. Each time it wakes up, it takes readings and sends that data to the cloud. My backend then receives those readings and IF needed, it calls a function on the device to update device settings (i.e. how long to sleep for next, stay awake, etc.). I used to always wait for a response before putting the device back to sleep with a 30 second timeout (way longer than I ever needed). Typically the device would receive the response within a few seconds and then fall right back to sleep.
However, now that the meter is on data operations, I would rather not send a response/call a function unless I absolutely had to. 98% of the time the response is just a flag indicating: “yeah, I heard you, you can go to sleep now”.
On one extreme, I could leave the timeout at 30 seconds and the device just sits there and listens for 30 seconds for any function calls while unnecessarily burning unnecessary battery power. On the other extreme, I could set the timeout to say 1 second but the device would likely already be sleeping by the time it needed and thus would never receive the stay awake config messages/be able to update settings remotely. I know the number is somewhere between 2 and 30 seconds but anyone have practical guidance on this. What would you consider worst case during weak/poor signal strength or peak network traffic? Per my backend performance monitoring, it’s about 100-400 ms to process each web hook. This is just one piece of the pie though.
I was thinking 6 seconds. That seem reasonable or is that even longer then necassary?