Currently, the native sdk stops the node exactly when it decides it needs to. I think we need to delegate the exact timing to the host application. Would go something like:
Native sdk sets timer to run the node in the background for a period of time
When that timer is up, we send a callback to the host application notifying it that the node needs to be stopped asap. That callback passes a block/closure that the host app will call once it is ready to have the node stop
The native sdk stops the node once that block/closure is called.
If the block/closure isn't called within n milliseconds, the node is stopped anyway.
The use case for something like this exists in the Photos app where we need to process camera roll photos, adding them to Textile. That takes time, time during which the node might need to shut down. This allows us to finish processing the currently running photo adds, and then allow the node to stop.
Currently, the native sdk stops the node exactly when it decides it needs to. I think we need to delegate the exact timing to the host application. Would go something like:
The use case for something like this exists in the Photos app where we need to process camera roll photos, adding them to Textile. That takes time, time during which the node might need to shut down. This allows us to finish processing the currently running photo adds, and then allow the node to stop.