Last active
January 7, 2023 10:57
-
-
Save bennadel/bc76eb54a8ab8072d03eb5da0621bc8a to your computer and use it in GitHub Desktop.
RequestTimeout Setting Affects CFThread Execution In Lucee CFML 5.3.6.61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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