Skip to content

Instantly share code, notes, and snippets.

@bennadel
Last active January 7, 2023 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennadel/bc76eb54a8ab8072d03eb5da0621bc8a to your computer and use it in GitHub Desktop.
Save bennadel/bc76eb54a8ab8072d03eb5da0621bc8a to your computer and use it in GitHub Desktop.
RequestTimeout Setting Affects CFThread Execution In Lucee CFML 5.3.6.61
<cfscript>
if ( application.keyExists( "testThread" ) ) {
// Dump CFThread data (without the Error, which is output next).
dump(
label = "Test Thread",
var = application.testThread,
hide = "Error"
);
// If CFThread ended in error, output the error.
// --
// NOTE: I'm hiding some keys just to make the output easier to read.
if ( application.testThread.keyExists( "Error" ) ) {
dump(
label = "Test Thread Error",
var = application.testThread.Error,
hide = "StackTrace,TagContext"
);
}
}
</cfscript>
<cfscript>
// Setting a request-timeout of 3-seconds.
setting
requestTimeout = 3
;
thread
type = "daemon"
name = "testThread"
{
systemOutput( "CFThread started, about to sleep().", true, false );
sleep( 5000 );
systemOutput( "CFThread completed successfully.", true, false );
}
// Store a reference to the thread we just created so that we can view the status
// of it in another script.
application.testThread = cfthread.testThread;
echo( "CFThread initiated." );
</cfscript>
<cfscript>
// Setting a request-timeout of 10-seconds. This is LONGER than the asynchronous
// thread is going to SLEEP.
setting
requestTimeout = 10
;
thread
type = "daemon"
name = "testThread"
{
systemOutput( "CFThread started, about to sleep().", true, false );
sleep( 5000 );
systemOutput( "CFThread completed successfully.", true, false );
}
// Store a reference to the thread we just created so that we can view the status
// of it in another script.
application.testThread = cfthread.testThread;
echo( "CFThread initiated." );
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment