-
Notifications
You must be signed in to change notification settings - Fork 13
Message retrieval leads to retries and failure #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@grokify Do you need anything else from me to substantiate this issue? |
API Response: Formatted and Explained Here is an excerpt from your API response dump along with it formatted with line wrap for easier scanning. From looking at the response in more detail, it seems like it has the following properties:
When you are rate limited and receive a 429 status code with a Since you are throttled again after waiting the 60 second penalty time, there may be something else going on. The log entries you see are from the SDK's automatic rate limit handling feature. If you are just using one client, typically waiting the Below, I've standard text to highlight the #<Faraday::Response:0x007f1ef4b29a48 @on_complete_callbacks=[], @env=#<Faraday::Env @method=:get @Body={"errorCode"=>"CMN-301", "message"=>"Request rate exceeded", "errors"=>[{"errorCode"=>"CMN-301", "message"=>"Request rate exceeded"}]} @url=#<URI::HTTPS https://platform.ringcentral.com/restapi/v1.0/account/346124008/extension/346247008/message-store/748682490016> @request=#<Faraday::RequestOptions (empty)> @request_headers={"User-Agent"=>"ringcentral-sdk-ruby/2.1.0 ruby/2.3.1 x86_64-linux", "RC-User-Agent"=>"ringcentral-sdk-ruby/2.1.0 ruby/2.3.1 x86_64-linux", "SDK-User-Agent"=>"ringcentral-sdk-ruby/2.1.0 ruby/2.3.1 x86_64-linux", "Authorization"=>"Bearer REDACTED_ACCESS_TOKEN"} @ssl=#<Faraday::SSLOptions verify=true> @response=#<Faraday::Response:0x007f1ef4b29a48 ...> @response_headers={"server"=>"nginx/1.10.2", "date"=>"Mon, 12 Jun 2017 09:49:56 GMT", "content-type"=>"application/json", "content-length"=>"161", "connection"=>"close", "x-rate-limit-group"=>"light", "x-rate-limit-limit"=>"50", "x-rate-limit-remaining"=>"50", "x-rate-limit-window"=>"60", "retry-after"=>"60", "www-authenticate"=>"Bearer realm="RingCentral REST API", error="CMN-301", error_description="Request rate exceeded"", "content-language"=>"en", "routingkey"=>"SJC01P07", "rcrequestid"=>"7db9fc62-4f54-11e7-94f2-005056af6d4e"} @status=429 @reason_phrase="Too Many Requests">> SDK Auto-Retry Feature Description The reason you are seeing those log entries is due to the SDK's auto-retry feature. The SDK's auto-retry feature is so that you don't have to handle the 429 throttling yourself. Normally if you receive a 429 error with a If your client is making one set of synchronous API calls, after waiting the time specified in the Verification Script and Output To verify the behavior, I created the following sample script which ran as expected with the output below. The output below retries quicker because this test app has a very limited rate limit plan for testing purposes. Sample Script: #!ruby
require 'ringcentral_sdk'
require 'pp'
client = RingCentralSdk::REST::Client.new do |config|
config.load_env = true
end
def get_one_message_url(client)
res = client.http.get 'account/~/extension/~/message-store?dateFrom=2015-01-01T00:00:00Z'
return res.body['records'][0]['uri']
end
def get_messages_repeat(client, url)
while true
res = client.http.get url
puts res.status
end
end
url = get_one_message_url client
get_messages_repeat client, url Output: $ ruby retry.rb
200
200
200
200
W, [2017-07-14T01:04:24.770517 #37866] WARN -- : You have been rate limited. Retrying in 10 seconds...
W, [2017-07-14T01:04:25.775837 #37866] WARN -- : 10...
W, [2017-07-14T01:04:30.792809 #37866] WARN -- : 5...
W, [2017-07-14T01:04:34.807407 #37866] WARN -- : Retrying...
200
200
200
W, [2017-07-14T01:04:38.894751 #37866] WARN -- : You have been rate limited. Retrying in 10 seconds...
W, [2017-07-14T01:04:39.897062 #37866] WARN -- : 10...
W, [2017-07-14T01:04:44.910473 #37866] WARN -- : 5...
W, [2017-07-14T01:04:48.919197 #37866] WARN -- : Retrying...
200
200
W, [2017-07-14T01:04:50.873054 #37866] WARN -- : You have been rate limited. Retrying in 10 seconds...
W, [2017-07-14T01:04:51.877520 #37866] WARN -- : 10...
W, [2017-07-14T01:04:56.891078 #37866] WARN -- : 5...
W, [2017-07-14T01:05:00.906421 #37866] WARN -- : Retrying...
200
200
W, [2017-07-14T01:05:02.843016 #37866] WARN -- : You have been rate limited. Retrying in 10 seconds...
W, [2017-07-14T01:05:03.845219 #37866] WARN -- : 10...
^C Multiple Clients Sharing Rate Limit Scenario If you are being throttled immediately, one cause for this may be if the app and user credentials are being used in multiple clients. The RingCentral API rate limits are for the composite key consisting of app and user credentails (app key + username/extension). If multiple clients share the app and user credentials, they will share/split the rate limit. In this scenario if one app is already throttled, a second app will be throttled as well. To resolve this scenario, ask why you have different clients sharing the same app and user credentials.
|
Closing this issue since this was transferred to a support case and it looks like the issue is multiple clients using the same app and user credentials. Feel free to ask other questions or reopen case here if there are more questions. |
We have a production app which has Call Log and Read Messages permissions. For many messages, we are able to retrieve the message details. For some, however, we get a retry followed by a failure.
Such as this message:
https://platform.ringcentral.com/restapi/v1.0/account/346124008/extension/346247008/message-store/748682490016
Then, I get the following perplexing series of messages:
How have we possibly been "rate limited" or submitted "Too Many Requests", when we have
x-rate-limit-remaining
of 50?The text was updated successfully, but these errors were encountered: