-
1. Re: Timeout for CFC Method
Dan Bracuk Aug 31, 2009 9:14 AM (in response to jarviswabi)The first thing I would try is to use the cfsetting tag for the entire cfc, not just one function.
-
2. Re: Timeout for CFC Method
Adam Cameron. Aug 31, 2009 6:38 PM (in response to jarviswabi)One could try this sort of thing, perhaps:
<cfthread action="run" name="t1">
<cfset cfthread.t1.done = false>
<!--- slow operation here --->
<cfset cfthread.t1.done = true>
</cfthread>
<cfthread action="join" name="t1" timeout="3000" />
<cfif not cfthread.t1.done>
<cfthread action="terminate" name="t1" />
</cfif>--
Adam
-
3. Re: Timeout for CFC Method
BKBK Sep 2, 2009 4:30 AM (in response to Dan Bracuk)1 person found this helpfulSimilar idea
<cftry>
<cfthread action="run" name="t1">
<!--- slow operation here --->
</cfthread><cfthread action="join" name="t1" timeout="3000" />
<cfif not (t1.status is "COMPLETED" or t1.status is "TERMINATED")>
<cfthread action="terminate" name="t1" /><cfthrow type="thread_t1_terminated">
</cfif><cfcatch type=thread_t1_terminated">
<!--- handle t1's termination --->
</cfcatch></cftry>
-
4. Re: Timeout for CFC Method
jarviswabi Sep 2, 2009 7:22 AM (in response to Adam Cameron.)Great suggestion, seems to work like a charm. I'll need to test it a bit to see if I need to allow more cfthreads to handle heavy volume. And there's a bit of scope gymnastics required when you're calling a cfthread within a cfc to make sure all the appropriate variables are accessible, but all in all, very slick solution, thanks very much!