Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The request has exceeded the allowable time limit Tag: cfhttp

I am facing this issue on a daily basis. I am having an application which Catches the huge data from various applications in the nightly schedule jobs through a cfhhtp call/request. The problem here is that it calls the 'extensive list of scopes' to catch the data, and unfortunately we cannot limit the scopes :( The timeout set in the Task is 9000 seconds(which already is quite high), but still it says timeout at cfhttp tag

"The request has exceeded the allowable time limit Tag: cfhttp".

I don't know how cfhttp works, but there should be some solution that if it catches data for some long time and from various scopes, it should not throw error and continues to work till the last request.

<cfset dynVarName = "funded" & bizforShort>
<cfif structKeyExists(variables,dynVarName)>
    <cfset howManyCustomScopes = listLen(structkeylist(variables[dynVarName],"|" ),"|" )>
    <cfmodule template="#Request.Library.CustomTags.VirtualPath#Scheduler_LogDetail.cfm"
                  Step="Funded Level Cache" Detail="Custom Scopes to be cached: #howManyCustomScopes#"
                  LogData=""></cfmodule>
    <cfloop collection="#variables[dynVarName]#" item="t">
        <cfset tempurl = variables[dynVarName][t]["url"]>
        <cfset tempurl = tempurl & "&retainCache=1">
        <cfoutput>
            <cfhttp url="#tempurl#" method="GET" resolveurl="false" timeout="9000">
            #tempurl#<br>
            <cfset scopesCachedCounter = scopesCachedCounter + 1>
            <cfmodule template="#Request.Library.CustomTags.VirtualPath#Scheduler_LogDetail.cfm" Step="Funded Scopes Cache" Detail="#scopesCachedCounter#.- #t#" LogData="#tempurl#"></cfmodule>
        </cfoutput>
    </cfloop>
</cfif>

Not: The page has one 'include' from where it catches the scope.

like image 555
Vasu Avatar asked Oct 21 '22 12:10

Vasu


1 Answers

At the top of the page, add the following cfsetting code, assigning a large enough value to requestTimeOut. This definitively sets the time out for the entire page, allowing any tags to take as long as they need as long as their cumulative execution time doesn't total more than this value.

<cfsetting requestTimeOut = "9000" />
like image 162
user3071284 Avatar answered Oct 24 '22 00:10

user3071284