Trying to implement auto-retry, or at least utilize the rate limiting header from responses on my program to wait so I do not exceed the limit.
Originally I was trying to utilize the header to find the current rate, then wait if it was about to exceed. But what I noticed was not all calls return a header for some reason? For example below the below call, it doesn't allow me to see the header so that I can see the what the returned rate is to wait on my next call.
ListCallQueuesParameters listCallQueuesParameters = new ListCallQueuesParameters
{
perPage = 100,
memberExtensionId = emailCheck.records[0].id.ToString()
};
var callQueues = await rc.Restapi("v1.0").Account("~").CallQueues().List(listCallQueuesParameters);
Digging through and I've found where in SDK 4.0 beta there was "Auto Retry" and "Rate Limit Helper" features. Was that ever implemented? I see in Nuget package manager there is a "RingCentral.Net.Retry" and "RingCentral.Net.RateLimit", is there documentation on utilizing these?
When reading the 4.0 beta feature document, the examples do not line up with those Nugets so here is what I tried - but I'm not sure if this is correct nor if I need more than just the below to make it work properly(Found most of the below when Googling the Nuget).
When testing after implementing these, it seems like the below code is working but I end up receiving the below error
(Code below is added after "var rc =")
var retryExtension = new RetryExtension();
retryExtension.enabled = true;
await rc.InstallExtension(retryExtension);
var rateLimitExtension = new RateLimitExtension();
rateLimitExtension.enabled = true;
await rc.InstallExtension(rateLimitExtension);
Also did this, but not even sure what it does, just shooting in the dark lol (probably redundant):
var rcExtList = new System.Collections.Generic.List<RingCentral.SdkExtension> { };
rcExtList.Add(rateLimitExtension);
rcExtList.Add(retryExtension);
rc.sdkExtensions = rcExtList;
Error received after wait:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidOperationException: The request message was already sent. Cannot send the same request message multiple times.
at System.Net.Http.HttpClient.CheckRequestMessage(HttpRequestMessage request)
at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at RingCentral.RestClient.<Request>d__31.MoveNext()
That was when making this call:
ReadAccountPresenceParameters readAccountPresenceParameters = new ReadAccountPresenceParameters
{
perPage = 200
};
var dndList = await rc.Restapi("v1.0").Account("~").Presence().Get(readAccountPresenceParameters);
Sorry if this is covered somewhere, I searched and was not able to find an up-to-date document/article