Doodle3D / doodle3d-firmware

The API of the Doodle3D WiFi box. This can for example talk to print3d, save settings, update the firmware etc.
www.doodle3d.com
GNU General Public License v2.0
13 stars 9 forks source link

Skip heavy tasks when they are already running #12

Open peteruithoven opened 10 years ago

peteruithoven commented 10 years ago

The following tasks are heavy and take a while. At the moment you can keep requesting them trough the api but this makes the api (uhttpd) quite unresponsive.

We should store the status in a separate file and have a check before running these tasks. When they are already running we should skip them.

Sign-in (which also happens when saving the settings) is the only one that is currently giving problems. The other ones are prevented in the Doodle3D client. So skipping these others would be a less important api improvement.

peteruithoven commented 10 years ago

I've made a general status utility that stores and retrieves status to and from files. Currently it's only used in signin, not to break something accidentally just for the release. It can now skip the signin when it's already running. The problem is that it's very easy to break, when the lua handler is used and the request is aborted (say by a timeout) the status stays at signing in and from then on will always skip signins. For this to work the cgi-bin instead of the lua handler should be used so that it can run independently and always make it to the idle state again.

Signin is called when it connects to a network in client mode and after saving settings. The second isn't currently a cgi-bin request because lua handler has a better performance. So I'll make the signin after saving settings a separate cgi-bin request.

peteruithoven commented 10 years ago

The client will now make a separate cgi-bin request to signin after the settings have bin saved.

Still todo: