I've only really used the cfthread tag when I have a process that is going 
to take longer than my server's request timeout. I'm sure there are more 
uses for it.

For what you're trying to do you probably want to use the background 
attribute of cfquery instead though. That will make openbd add your query 
to a queue and run it in the background when resources are free.

Anyone agree?

On Monday, July 30, 2012 1:35:02 PM UTC-5, Randy Johnson wrote:
>
> Hello,
>
> I was wondering if this is a proper use case for cfthread.  This cfthread 
> would be ran via the application file on each page request.
>
> <cfthread
> name="stats"
> action="run" 
> priority="LOW" 
> ipaddress = "#cgi.remote_addr#"
> vcgi = "#CGI#"
> vsession = "#SESSION#"
> vurl="#URL#"
> vform = "#FORM#"
> vcreatedat="#now()#"
> > 
>
> <cfif structKeyExists(vform,"cardnumber")><Cfset 
> structDelete(vform,"CARDNUMBER")></cfif>
> <cfif structKeyExists(vform,"CARDCODE")><Cfset 
> structDelete(vform,"CARDCODE")></cfif>
>
> <cfquery name="insertRandyStats" datasource="Randystats">
> insert into stats 
> (createdat,ipaddress,cgi_stats,session_stats,url_stats,form_stats)
> values(
> <cfqueryparam cfsqltype="cf_sql_timestamp" value="#vcreatedat#">,
> <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#ipaddress#">,
> <cfqueryparam cfsqltype="cf_sql_longvarchar" 
> value="#SerializeJSON(vcgi)#">,
> <cfqueryparam cfsqltype="cf_sql_longvarchar" 
> value="#SerializeJSON(vsession)#">,
> <cfqueryparam cfsqltype="cf_sql_longvarchar" 
> value="#SerializeJSON(vurl)#">,
> <cfqueryparam cfsqltype="cf_sql_longvarchar" 
> value="#SerializeJSON(vform)#">);
> </cfquery>
> </cfthread> 
>
> Is there any issues that might arise from doing the stats line insert like 
> this?
>
> Thanks!
>
> Randy
>

-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

Reply via email to