mirror of
https://github.com/apache/superset.git
synced 2024-09-06 13:57:40 -04:00
Attempt to reduce asyncEvent test flakiness (#14497)
This commit is contained in:
parent
9b42eec064
commit
fa0915d9e6
@ -56,13 +56,15 @@ const RETRY_DELAY = 100;
|
|||||||
|
|
||||||
let config: AppConfig;
|
let config: AppConfig;
|
||||||
let transport: string;
|
let transport: string;
|
||||||
let polling_delay: number;
|
let pollingDelayMs: number;
|
||||||
|
let pollingTimeoutId: number;
|
||||||
let listenersByJobId: Record<string, ListenerFn>;
|
let listenersByJobId: Record<string, ListenerFn>;
|
||||||
let retriesByJobId: Record<string, number>;
|
let retriesByJobId: Record<string, number>;
|
||||||
let lastReceivedEventId: string | null | undefined;
|
let lastReceivedEventId: string | null | undefined;
|
||||||
|
|
||||||
export const init = (appConfig?: AppConfig) => {
|
export const init = (appConfig?: AppConfig) => {
|
||||||
if (!isFeatureEnabled(FeatureFlag.GLOBAL_ASYNC_QUERIES)) return;
|
if (!isFeatureEnabled(FeatureFlag.GLOBAL_ASYNC_QUERIES)) return;
|
||||||
|
if (pollingTimeoutId) clearTimeout(pollingTimeoutId);
|
||||||
|
|
||||||
listenersByJobId = {};
|
listenersByJobId = {};
|
||||||
retriesByJobId = {};
|
retriesByJobId = {};
|
||||||
@ -84,7 +86,7 @@ export const init = (appConfig?: AppConfig) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
transport = config.GLOBAL_ASYNC_QUERIES_TRANSPORT || TRANSPORT_POLLING;
|
transport = config.GLOBAL_ASYNC_QUERIES_TRANSPORT || TRANSPORT_POLLING;
|
||||||
polling_delay = config.GLOBAL_ASYNC_QUERIES_POLLING_DELAY || 500;
|
pollingDelayMs = config.GLOBAL_ASYNC_QUERIES_POLLING_DELAY || 500;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lastReceivedEventId = localStorage.getItem(LOCALSTORAGE_KEY);
|
lastReceivedEventId = localStorage.getItem(LOCALSTORAGE_KEY);
|
||||||
@ -185,7 +187,7 @@ const loadEventsFromApi = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (transport === TRANSPORT_POLLING) {
|
if (transport === TRANSPORT_POLLING) {
|
||||||
setTimeout(loadEventsFromApi, polling_delay);
|
pollingTimeoutId = window.setTimeout(loadEventsFromApi, pollingDelayMs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user