我每天都面临这个问题.我有一个应用程序通过cfhhtp呼叫/请求从夜间计划作业中的各种应用程序中获取大量数据.这里的问题是它调用'扩展的范围列表'来捕获数据,不幸的是我们不能限制范围:(任务中设置的超时是9000秒(已经很高),但它仍然表示超时在cfhttp标签处
"请求已超过允许的时间限制Tag:cfhttp".
我不知道它是如何cfhttp工作的,但应该有一些解决方案,如果它长时间捕获数据并从各种范围捕获,它不应该抛出错误并继续工作直到最后一个请求.
<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>
Run Code Online (Sandbox Code Playgroud)
不是:页面有一个"包含",它从中捕获范围.
在页面顶部,添加以下cfsetting代码,为 分配足够大的值requestTimeOut。这明确地设置了整个页面的超时,允许任何标签只要它们需要的时间,只要它们的累积执行时间不超过这个值。
<cfsetting requestTimeOut = "9000" />
Run Code Online (Sandbox Code Playgroud)