We’ve been moving management of our clients and users into our own administrative application. This involves calling the management API more often. We’ve run into rate limit exceptions as one would expect when doing a bunch of automated operations in succession. We’re catching the RateLimitApiException exception in our .NET core web service. In the latest SDK we see two properties RetryAfter and Reset on the RateLimit property of the exception object. The former is a long and the latter a nullable DateTimeOffset. In our logs we see that RetryAfter is 1 and the Reset is null.
I’d like to change our code so that it will delay for an appropriate period of time before it continues making requests. It currently just waits 5 seconds. What does the value for RetryAfter represent? Is it seconds, milliseconds, etc? Adding a unit to the SDK documentation would be helpful. I would think that “awaiting” a Task.Delay((int)e.RateLimit.RetryAfter * 1000) would work if the value of 1 indicated to wait one second.
Also, why is the Reset value always null? I have not found an instance in our logs where it is not the case.