do backoff for all retries (not just 429s) (#92)
diff --git a/provider/lib/utils.js b/provider/lib/utils.js
index 122bb06..4828b9b 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -370,10 +370,7 @@
}
else {
if (retryCount < that.retryAttempts ) {
- var timeout = that.retryDelay;
- if (response && response.statusCode === 429) {
- timeout = retryCount === 0 ? 60000 : 1000 * Math.pow(retryCount, 2);
- }
+ var timeout = response && response.statusCode === 429 && retryCount === 0 ? 60000 : 1000 * Math.pow(retryCount + 1, 2);
logger.info(method, 'attempting to fire trigger again', dataTrigger.id, 'Retry Count:', (retryCount + 1));
setTimeout(function () {
that.postTrigger(dataTrigger, form, uri, auth, (retryCount + 1))