Azure Python 函数重试限制在逻辑应用程序中不起作用
Azure Python Function Retry Limitting not Working in Logic Apps
我尝试了两种方法来限制“失败”函数的重试次数,但都没有奏效(如下所述)。我在发展方面遇到了挑战,因此我们将不胜感激。
上下文:该函数放置在一个逻辑应用程序中,在电子邮件附件保存到 blob 后由电子邮件触发。保存文件后,该功能成功执行,但逻辑应用程序 returns“BadRequest。Http 请求失败:服务器未在超时限制内响应”运行-时间 2-3 分钟后.然后逻辑应用再重试该函数 4 次。
方法 1:我将重试放入 host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
},
"retry": {
"strategy": "fixedDelay",
"maxRetryCount": 0,
"delayInterval": "00:00:05"
}
}
方法 2:我将相同的片段放入 function.json:
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
],
"retry": {
"strategy": "fixedDelay",
"maxRetryCount": 0,
"delayInterval": "00:00:10"
}
}
重试策略由azure logic app
定义,您不应该在函数中配置它,而是在 azure logic app 操作中配置重试策略。可以参考Retry policies:
For the most basic exception and error handling, you can use a retry policy in any action or trigger where supported, for example, see HTTP action. A retry policy specifies whether and how the action or trigger retries a request when the original request times out or fails, which is any request that results in a 408, 429, or 5xx response. If no other retry policy is used, the default policy is used.
如果要将重试次数配置为0,请按照以下步骤操作。
可以点击Http
动作右上角的···
,然后点击Settings
,[=15]下的select None
=]:
我尝试了两种方法来限制“失败”函数的重试次数,但都没有奏效(如下所述)。我在发展方面遇到了挑战,因此我们将不胜感激。
上下文:该函数放置在一个逻辑应用程序中,在电子邮件附件保存到 blob 后由电子邮件触发。保存文件后,该功能成功执行,但逻辑应用程序 returns“BadRequest。Http 请求失败:服务器未在超时限制内响应”运行-时间 2-3 分钟后.然后逻辑应用再重试该函数 4 次。
方法 1:我将重试放入 host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
},
"retry": {
"strategy": "fixedDelay",
"maxRetryCount": 0,
"delayInterval": "00:00:05"
}
}
方法 2:我将相同的片段放入 function.json:
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
],
"retry": {
"strategy": "fixedDelay",
"maxRetryCount": 0,
"delayInterval": "00:00:10"
}
}
重试策略由azure logic app
定义,您不应该在函数中配置它,而是在 azure logic app 操作中配置重试策略。可以参考Retry policies:
For the most basic exception and error handling, you can use a retry policy in any action or trigger where supported, for example, see HTTP action. A retry policy specifies whether and how the action or trigger retries a request when the original request times out or fails, which is any request that results in a 408, 429, or 5xx response. If no other retry policy is used, the default policy is used.
如果要将重试次数配置为0,请按照以下步骤操作。
可以点击Http
动作右上角的···
,然后点击Settings
,[=15]下的select None
=]: