Open alexkli opened 5 years ago
Some thoughts on a possible implementation:
openwhisk
constructor options.I could provide a PR if that helps.
FYI prior discussion: https://github.com/apache/incubator-openwhisk-client-js/issues/119
@starpit I saw it, but it was mentioning network level failures. I am quite explicitly interested in handling 429 rate limit errors, since we can get them consistently with too much traffic 😄
As discussed in #119, I didn't agree with introducing generic retry behaviour for all lower-level networking issues. However, I can see the case for a retry mechanism for explicit cases like the HTTP 429 returned by the platform API.
This should be turned off by default ("no surprises for the user and no breaking changes") and configurable through constructor options as @alexkli suggested. Exponential back-off is the correct approach.
@alexkli If you want to provide a PR - we can discuss the approach?
I was going to start the process of a release this library to push out the recent change (https://github.com/apache/incubator-openwhisk-client-js/pull/147) but will wait until this is in?
Maybe it would be better to implement this in the client module rather than the resource class? Resources could pass a new parameter to indicate whether 429 errors with retryable. https://github.com/apache/incubator-openwhisk-client-js/blob/master/lib/client.js
I could take a look at it next week, but I wouldn’t want to block any release for it :-)
Right, in the client.js. I missed that this is where the http request logic is actually implemented.
Hello @alexkli - do you know if you'll be able to submit a PR this week? No rush - but as some other PRs have come in I'm now thinking about getting that release out.
@jthomas Unfortunately no, some other priorities pushed this down on my list. With the right concurrency settings in openwhisk the 429 problem went away for us (at least for now). Still planning to take a look maybe in a few weeks.
When using
openwhisk.action.invoke()
or other operations one can encounter HTTP 429 TOO MANY REQUESTS status code responses from Openwhisk's rate limiting. It would be nice if the openwhisk js client can provide a retry mechanism out of the box.The suggested approach is a exponential backoff. This was implemented e.g. here: https://github.com/apache/incubator-openwhisk-package-cloudant/pull/90