mirror of
https://github.com/apache/superset.git
synced 2026-04-22 01:24:43 +00:00
Syncing the timeout param from backend (#3329)
* Syncing the timeout param from backend * Linting
This commit is contained in:
committed by
GitHub
parent
527572c3eb
commit
2923a125db
@@ -1,6 +1,5 @@
|
||||
import { getExploreUrl } from '../exploreUtils';
|
||||
import { getFormDataFromControls } from '../stores/store';
|
||||
import { QUERY_TIMEOUT_THRESHOLD } from '../../constants';
|
||||
import { triggerQuery } from './exploreActions';
|
||||
|
||||
const $ = window.$ = require('jquery');
|
||||
@@ -24,8 +23,8 @@ export function chartUpdateStopped(queryRequest) {
|
||||
}
|
||||
|
||||
export const CHART_UPDATE_TIMEOUT = 'CHART_UPDATE_TIMEOUT';
|
||||
export function chartUpdateTimeout(statusText) {
|
||||
return { type: CHART_UPDATE_TIMEOUT, statusText };
|
||||
export function chartUpdateTimeout(statusText, timeout) {
|
||||
return { type: CHART_UPDATE_TIMEOUT, statusText, timeout };
|
||||
}
|
||||
|
||||
export const CHART_UPDATE_FAILED = 'CHART_UPDATE_FAILED';
|
||||
@@ -49,7 +48,7 @@ export function removeChartAlert() {
|
||||
}
|
||||
|
||||
export const RUN_QUERY = 'RUN_QUERY';
|
||||
export function runQuery(formData, force = false) {
|
||||
export function runQuery(formData, force = false, timeout = 60) {
|
||||
return function (dispatch, getState) {
|
||||
const { explore } = getState();
|
||||
const lastQueryFormData = getFormDataFromControls(explore.controls);
|
||||
@@ -62,12 +61,12 @@ export function runQuery(formData, force = false) {
|
||||
},
|
||||
error(err) {
|
||||
if (err.statusText === 'timeout') {
|
||||
dispatch(chartUpdateTimeout(err.statusText));
|
||||
dispatch(chartUpdateTimeout(err.statusText, timeout));
|
||||
} else if (err.statusText !== 'abort') {
|
||||
dispatch(chartUpdateFailed(err.responseJSON));
|
||||
}
|
||||
},
|
||||
timeout: QUERY_TIMEOUT_THRESHOLD,
|
||||
timeout: timeout * 1000,
|
||||
});
|
||||
dispatch(chartUpdateStarted(queryRequest, lastQueryFormData));
|
||||
dispatch(triggerQuery(false));
|
||||
|
||||
Reference in New Issue
Block a user