Stop! I want to get off.
|
I remember many years ago being at a theme park and all strapped in to start a rollercoaster ride. No sooner had we left the station than someone started screaming: he had decided that he didn't want to go on the ride. The ride stopped halfway up the first rise. The systems were checked, the screaming continued, and everything was deemed safe to proceed. So off we went. When we returned to the station, one man departed the station very quickly. Many of the scripts you write simply start, run, and finish. But some are more complex and will take more time to run. In those cases, a user may want to stop the process—perhaps it is taking too long, or they have accidentally run the wrong report. How do we handle the user wanting to stop? As with most things, the best answer is "it depends." With the roller coaster ride the operators had three options:
A script can have similar options. But once it has started, stopping it safely means considering its current state and restoring the appropriate starting state. In practice, that may mean undoing changes already made. The number and type of changes will depend on both the script’s process and how far it has progressed when it is stopped. Over the next few days, we’ll look at some example scripts and ways to handle a request to stop.
|