When starting a page (for example), and reading a business object in the initialize, we often put a debug statement with a sleep:
while (i < 5000 && !this.contentSearch) {
debug('sleeping');
sleep(5);
}
but what’s the ‘right’ thing to do if the timeout occurs?
I assume throw up a dialog telling the user that there’s a delay and to try later (an awful message but watcha gonna do), and send an error report through to the support folks (through a throw connected to your global error handler)?
I didn’t quite follow the pattern you are using and why this loop is there. Could you give a litte more context?
sure, we have this all over when we’re starting an Initialize method on a page, and we need to ensure (which is pretty much always) that business object automatic reads are done and the data is available.
If it takes too long to read the data, we should take some action (report to the back end for support to take a look at the performance issue) and give the user some feedback (but not sure what a best practice here would be…pop up a dialog to tell them that things are busy and do another timer…and if that times out again then stay try later (which I hate)?
and in terms of back end (reporting this timeout through the error handling logic), this may be a trigger to turn off a feature flag, so that a particular function that’s dependent on this data is no longer available (code being in place to stop users from using that functionality with appropriate messaging)