diff options
Diffstat (limited to 'app/assets/javascripts/monitoring/requests/index.js')
-rw-r--r-- | app/assets/javascripts/monitoring/requests/index.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/assets/javascripts/monitoring/requests/index.js b/app/assets/javascripts/monitoring/requests/index.js index 28064361768..4a12ca06197 100644 --- a/app/assets/javascripts/monitoring/requests/index.js +++ b/app/assets/javascripts/monitoring/requests/index.js @@ -3,10 +3,10 @@ import statusCodes from '~/lib/utils/http_status'; import { backOff } from '~/lib/utils/common_utils'; import { PROMETHEUS_TIMEOUT } from '../constants'; -const cancellableBackOffRequest = makeRequestCallback => +const cancellableBackOffRequest = (makeRequestCallback) => backOff((next, stop) => { makeRequestCallback() - .then(resp => { + .then((resp) => { if (resp.status === statusCodes.NO_CONTENT) { next(); } else { @@ -16,19 +16,19 @@ const cancellableBackOffRequest = makeRequestCallback => // If the request is cancelled by axios // then consider it as noop so that its not // caught by subsequent catches - .catch(thrown => (axios.isCancel(thrown) ? undefined : stop(thrown))); + .catch((thrown) => (axios.isCancel(thrown) ? undefined : stop(thrown))); }, PROMETHEUS_TIMEOUT); export const getDashboard = (dashboardEndpoint, params) => cancellableBackOffRequest(() => axios.get(dashboardEndpoint, { params })).then( - axiosResponse => axiosResponse.data, + (axiosResponse) => axiosResponse.data, ); export const getPrometheusQueryData = (prometheusEndpoint, params, opts) => cancellableBackOffRequest(() => axios.get(prometheusEndpoint, { params, ...opts })) - .then(axiosResponse => axiosResponse.data) - .then(prometheusResponse => prometheusResponse.data) - .catch(error => { + .then((axiosResponse) => axiosResponse.data) + .then((prometheusResponse) => prometheusResponse.data) + .catch((error) => { // Prometheus returns errors in specific cases // https://prometheus.io/docs/prometheus/latest/querying/api/#format-overview const { response = {} } = error; |