Xrm.Tools.CRMWebAPI icon indicating copy to clipboard operation
Xrm.Tools.CRMWebAPI copied to clipboard

Polly integration

Open rasmuschristensen opened this issue 5 years ago • 2 comments

Working with bulk inserts I pretty often run into the request limit of dynamics. I've tried to wrap the calls using Polly and a policy that handles CRMWebAPIException. For some reason this has no effect and I dont see the WaitAndRetry in effect. I'm using Azure Functions running .net Core, and looking into this lib I see a lot of classic HttpClient code. Not sure if this mix might cause some issues.

rasmuschristensen avatar Aug 16 '19 13:08 rasmuschristensen

@rasmuschristensen , can you share your code here? I'm actually planning to opening a pull request to this repo with the latest .net core implementation using the httpclient factory and providing the retry policy there.

Also, you have to think about idempotency for requests that are not GET, so any POST/PATCH will need additional handling/custom handling on the implementing application side.

I'm not sure if you're aware of the new API limits (no I'm not talking about the ones from March 2019 https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/api-limits)

I'm talking about new API Limits from August 2019: https://docs.microsoft.com/en-us/power-platform/admin/api-request-limits-allocations

so yes, everyone should be using $batch request (with max of 100 requests) now or ExecuteMultipleRequest (with max 1000 requests), however, if things go wrong with failed requests in those batches, then for idempotency you'll need to do Get OR RetrieveRequest.

Anyway, things are going to get much complicated/complex going forward, that's for sure.

mohsinonxrm avatar Sep 08 '19 03:09 mohsinonxrm

@rasmuschristensen , I'll be opening a pull request in a couple of days (already coded, going to test a bit more) and submitting the changes for @davidyack to review and merge.

mohsinonxrm avatar Jun 18 '20 17:06 mohsinonxrm