I have a scheduled task that runs once a day that builds an XML file that I pass off to another group. Recently the amount of data has greatly increased and is now causing the task to time out (I think). I have tried to optimize my script as much as possible but with no luck. It times out long before an hour and I don't get any kind of ColdFusion error. Instead I get a "This page cannot be found" after it runs.
- Could this be a timeout someplace other than Coldfusion?
- Is there a more efficient way to build this XML file?
file:
<cfsetting requesttimeout="7200">
<cftry>
<cfquery datasource="datasource" name="getPeople">
select PersonID, FirstName, LastName
from People
</cfquery>
<cfquery datasource="datasource" name="getDepartments">
select d.DepartmentID, DepartmentName, pd.PersonID
from Department d inner join PersonDepartment pd on d.DepartmentID = pd.DepartmentID
</cfquery>
<cfquery datasource="datasource" name="getPapers">
select PaperID, PaperTitle, PaperDescription, pp.PersonID
from Paper p inner join PersonPaper pp on p.PaperID = pp.PaperID
</cfquery>
<cfsavecontent variable="theXML"><?xml version="1.0" encoding="utf-8" ?><people>
<cfoutput query="getPeople"><cfsilent>
<cfquery dbtype="query" name="getPersonDepartments">
select DepartmentID, DepartmentName
from getDepartments
where PersonID = #getPeople.PersonID#
</cfquery>
<cfquery dbtype="query" name="getPersonPapers">
select PaperID, PaperDescription
from getpapers
where PersonID = #getPeople.PersonID#
</cfquery>
</cfsilent> <person>
<person_id>
#getPeople.PersonID#
</faculty_id>
<person_first_name>
#getPeople.Firstname#
</person_first_name>
<person_last_name>
#getPeople.LastName#
</person_last_name><cfif getPersonDepartments.recordcount gt 0>
<departments><cfloop query="getPersonDepartments">
<department>
<department_id>
#getPersonDepartments.DepartmentID#
</department_id>
<department_name>
#getPersonDepartments.DepartmentName#
</department_name>
</department></cfloop>
</departments></cfif><cfif getPersonPapers.recordcount gt 0>
<papers><cfloop query="getPersonPapers">
<paper>
<paper_id>
#getPersonPapers.PaperID#
</paper_id>
<paper_description>
#getPersonPapers.PaperDescription#
</paper_description>
</paper></cfloop>
</papers></cfif>
</person>
</cfoutput></faculty>
</cfsavecontent>
<!--- Generate the file that contains the RSS --->
<cffile action="write" file="#application.serverroot#/People.xml" output="#theXml#" nameconflict="overwrite">
<cfcatch>
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
Done!