일반적으로 제한 테스트는 Microsoft 365 서버에 부하가 많이 걸릴 때 드물게 발생하기 때문에 어렵습니다. 개발자 프록시를 사용하여 제한 응답을 시뮬레이션하고 애플리케이션이 올바르게 처리하는지 확인할 수 있습니다.
Microsoft 365 API에서 제한을 시뮬레이션하려면 GraphRandomErrorPlugin 및 RetryAfterPlugin을 사용합니다.
GraphRandomErrorPlugin는 Microsoft 365 API에 대한 요청 제한 응답을 반환합니다. API RetryAfterPlugin 의 지시에 따라 앱이 백오프되는지 확인합니다.
시작하려면 개발자 프록시 구성 파일에서 GraphRandomErrorPluginRetryAfterPlugin 사용하도록 설정합니다.
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/rc.schema.json",
"plugins": [
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
},
{
"name": "GraphRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "graphRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
"https://graph.microsoft.com/beta/*",
"https://graph.microsoft.us/v1.0/*",
"https://graph.microsoft.us/beta/*",
"https://dod-graph.microsoft.us/v1.0/*",
"https://dod-graph.microsoft.us/beta/*",
"https://microsoftgraph.chinacloudapi.cn/v1.0/*",
"https://microsoftgraph.chinacloudapi.cn/beta/*",
"!https://*.sharepoint.*/*_api/web/GetClientSideComponents",
"https://*.sharepoint.*/*_api/*",
"https://*.sharepoint.*/*_vti_bin/*",
"https://*.sharepoint-df.*/*_api/*",
"https://*.sharepoint-df.*/*_vti_bin/*"
]
}
주의
구성 파일에 GraphRandomErrorPlugin 앞에 RetryAfterPlugin을 추가합니다. 이후에 추가하면 RetryAfterPlugin이(가) 요청을 처리할 기회가 생기기 전에 GraphRandomErrorPlugin에 의해 요청이 실패할 것입니다.
다음으로, GraphRandomErrorPlugin을(를) 제한 오류를 시뮬레이션하도록 구성합니다.
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/rc.schema.json",
"plugins": [
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
},
{
"name": "GraphRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "graphRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
"https://graph.microsoft.com/beta/*",
"https://graph.microsoft.us/v1.0/*",
"https://graph.microsoft.us/beta/*",
"https://dod-graph.microsoft.us/v1.0/*",
"https://dod-graph.microsoft.us/beta/*",
"https://microsoftgraph.chinacloudapi.cn/v1.0/*",
"https://microsoftgraph.chinacloudapi.cn/beta/*",
"!https://*.sharepoint.*/*_api/web/GetClientSideComponents",
"https://*.sharepoint.*/*_api/*",
"https://*.sharepoint.*/*_vti_bin/*",
"https://*.sharepoint-df.*/*_api/*",
"https://*.sharepoint-df.*/*_vti_bin/*"
],
"graphRandomErrorPlugin": {
"allowedErrors": [ 429 ]
}
}
구성 파일로 귀하의 개발 프록시를 시작하고 앱을 테스트하여 제한 처리 방법을 확인합니다.
애플리케이션이 제한될 때 백오프되지만 요청에 지정된 시간 동안 기다리지 않으면 다음과 유사한 Calling https://graph.microsoft.com/v1.0/endpoint again before waiting for the Retry-After period. Request will be throttled메시지가 표시됩니다.
이 메시지는 귀하의 애플리케이션이 속도 제한을 올바르게 처리하지 않아 불필요하게 속도 제한을 연장하고 있음을 나타냅니다. 앱의 제한 처리를 개선하려면 요청을 다시 시도하기 전에 Retry-After 헤더에 지정된 시간 동안 추가로 대기하도록 코드를 업데이트하세요.
Dev Proxy