Timeout
Timeout
Since Lucee 6.0, <cftimeout> defines a timeout for a code block.
Basic Usage
<cftimeout timespan="#createTimespan(0, 0, 0, 0,100)#" forcestop=true ontimeout="#function(timespan) {
dump(timespan);
}">
<cfset sleep(1000)>
</cftimeout>
The onTimeout listener is called when timeout is reached.
Error Handling
Add onError listener for exceptions within the timeout block. Rethrow to escalate:
<cftimeout timespan="0.1"
onerror="#function(cfcatch){
dump(arguments);
throw cfcatch;
}#"
ontimeout="#function(timespan) {
dump(timespan);
}#">
<cfthrow message="upsi dupsi">
</cftimeout>