From 6c006d0a789633b3379e6d658582b43836dba2a1 Mon Sep 17 00:00:00 2001 From: Clicky Date: Mon, 2 Jun 2014 13:15:10 -0700 Subject: [PATCH] Don't retry on http status codes >= 300 These status codes are likely to be to be unretryable errors coming from influx (most likely bad queries) --- src/app/services/influxdb/influxdbDatasource.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/services/influxdb/influxdbDatasource.js b/src/app/services/influxdb/influxdbDatasource.js index 4f86cc5ad02..f33b44fefec 100644 --- a/src/app/services/influxdb/influxdbDatasource.js +++ b/src/app/services/influxdb/influxdbDatasource.js @@ -131,12 +131,14 @@ function (angular, _, kbn) { function retry(deferred, callback, delay) { return callback().then(undefined, function(reason) { - if (reason.status !== 0) { + if (reason.status !== 0 || reason.status >= 300) { deferred.reject(reason); + } + else { + setTimeout(function() { + return retry(deferred, callback, Math.min(delay * 2, 30000)); + }, delay); } - setTimeout(function() { - return retry(deferred, callback, Math.min(delay * 2, 30000)); - }, delay); }); }